Home | Trees | Indices | Help |
---|
|
object --+ | SSHClient
A high-level representation of a session with an SSH server. This class wraps Transport, Channel, and SFTPClient to take care of most aspects of authenticating and opening channels. A typical use case is:
client = SSHClient() client.load_system_host_keys() client.connect('ssh.example.com') stdin, stdout, stderr = client.exec_command('ls -l')
You may pass in explicit overrides for authentication and server host key checking. The default mechanism is to try to use local key files or an SSH agent (if one is running).
Since: 1.6
Instance Methods | |||
|
|||
|
|||
|
|||
tuple(ChannelFile, ChannelFile, ChannelFile) |
|
||
HostKeys |
|
||
Transport |
|
||
Channel |
|
||
|
|||
|
|||
SFTPClient |
|
||
|
|||
|
|||
|
|||
Inherited from |
Properties | |
Inherited from |
Method Details |
Create a new SSHClient.
|
Connect to an SSH server and authenticate to it. The server's host key is checked against the system host keys (see load_system_host_keys) and any local host keys (load_host_keys). If the server's hostname is not found in either set of host keys, the missing host key policy is used (see set_missing_host_key_policy). The default policy is to reject the key and raise an SSHException. Authentication is attempted in the following order of priority:
If a private key requires a password to unlock it, and a password is passed in, that password will be used to attempt to unlock the key.
|
Execute a command on the SSH server. A new Channel is opened and
the requested command is executed. The command's input and output
streams are returned as python
|
Get the local HostKeys object. This can be used to examine the local host keys or change them.
|
Return the underlying Transport object for this SSH connection. This can be used to perform lower-level tasks, like opening specific kinds of channels.
|
Start an interactive shell session on the SSH server. A new Channel is opened and connected to a pseudo-terminal using the requested terminal type and size.
|
Load host keys from a local host-key file. Host keys read with this method will be checked after keys loaded via load_system_host_keys, but will be saved back by save_host_keys (so they can be modified). The missing host key policy AutoAddPolicy adds keys to this set and saves them, when connecting to a previously-unknown server. This method can be called multiple times. Each new set of host keys will be merged with the existing set (new replacing old if there are conflicts). When automatically saving, the last hostname is used.
|
Load host keys from a system (read-only) file. Host keys read with this method will not be saved back by save_host_keys. This method can be called multiple times. Each new set of host keys will be merged with the existing set (new replacing old if there are conflicts). If
|
Open an SFTP session on the SSH server.
|
Save the host keys back to a file. Only the host keys loaded with load_host_keys (plus any added directly) will be saved -- not any host keys loaded with load_system_host_keys.
|
Set the channel for logging. The default is
|
Set the policy to use when connecting to a server that doesn't have a host key in either the system or local HostKeys objects. The default policy is to reject all unknown servers (using RejectPolicy). You may substitute AutoAddPolicy or write your own policy class.
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Sun Jul 6 18:30:29 2008 | http://epydoc.sourceforge.net |