twisted.conch.endpoints.SSHCommandClientEndpoint.newConnection(cls, reactor, command, username, hostname, port=None, keys=None, password=None, agentEndpoint=None, knownHosts=None, ui=None)
class method documentationtwisted.conch.endpoints.SSHCommandClientEndpoint
View Source
Create and return a new endpoint which will try to create a new
connection to an SSH server and run a command over it. It will also close
the connection if there are problems leading up to the command being
executed, after the command finishes, or if the connection Deferred
is
cancelled.
Parameters | reactor | The reactor to use to establish the connection. (type: IReactorTCP
provider) |
command | See __init__ 's
command argument. | |
username | The username with which to authenticate to the SSH server. (type: bytes ) | |
hostname | The hostname of the SSH server. (type: bytes ) | |
port | The port number of the SSH server. By default, the standard SSH port
number is used. (type: int ) | |
keys | Private keys with which to authenticate to the SSH server, if key
authentication is to be attempted (otherwise None ). (type: list
of Key ) | |
password | The password with which to authenticate to the SSH server, if password
authentication is to be attempted (otherwise None ). (type: bytes
or None ) | |
agentEndpoint | An IStreamClientEndpoint
provider which may be used to connect to an SSH agent, if one is to be used
to help with authentication. (type: IStreamClientEndpoint
provider) | |
knownHosts | The currently known host keys, used to check the host key presented by the
server we actually connect to. (type: KnownHostsFile ) | |
ui | An object for interacting with users to make decisions about whether to
accept the server host keys. If None ,
a ConsoleUI
connected to /dev/tty will be used; if /dev/tty is unavailable, an object
which answers b"no" to all prompts will be used. (type: None
or ConsoleUI ) | |
Returns | A new instance of cls (probably SSHCommandClientEndpoint ). |