Home | Trees | Index | Help |
---|
Package paramiko :: Class SSHClient |
|
object
--+
|
SSHClient
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
Method Summary | |
---|---|
Create a new SSHClient. | |
Close this SSHClient and its underlying Transport . | |
Connect to an SSH server and authenticate to it. | |
tuple(ChannelFile , ChannelFile ,
ChannelFile )
|
Execute a command on the SSH server. |
HostKeys
|
Get the local HostKeys object. |
Transport
|
Return the underlying Transport object for this SSH
connection. |
Channel
|
Start an interactive shell session on the SSH server. |
Load host keys from a local host-key file. | |
Load host keys from a system (read-only) file. | |
SFTPClient
|
Open an SFTP session on the SSH server. |
Save the host keys back to a file. | |
Set the channel for logging. | |
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. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Method Details |
---|
__init__(self)
Create a new SSHClient.
|
close(self)Close this SSHClient and its underlyingTransport .
|
connect(self, hostname, port=22, username=None, password=None, pkey=None, key_filename=None, timeout=None)Connect to an SSH server and authenticate to it. The server's host
key is checked against the system host keys (see
|
exec_command(self, command, bufsize=-1)Execute a command on the SSH server. A newChannel is opened and the requested
command is executed. The command's input and output streams are
returned as python file -like objects representing stdin,
stdout, and stderr.
|
get_host_keys(self)Get the localHostKeys object. This can be used to
examine the local host keys or change them.
|
get_transport(self)Return the underlyingTransport object for this SSH connection.
This can be used to perform lower-level tasks, like opening specific
kinds of channels.
|
invoke_shell(self, term='vt100', width=80, height=24)Start an interactive shell session on the SSH server. A newChannel is opened and connected to a
pseudo-terminal using the requested terminal type and size.
|
load_host_keys(self, filename)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(self, filename=None)Load host keys from a system (read-only) file. Host keys read with
this method will not be saved back by 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). Iffilename is left as None , an attempt
will be made to read keys from the user's local "known hosts"
file, as used by OpenSSH, and no exception will be raised if the file
can't be read. This is probably only useful on posix.
|
open_sftp(self)Open an SFTP session on the SSH server.
|
save_host_keys(self, filename)Save the host keys back to a file. Only the host keys loaded withload_host_keys (plus any added directly)
will be saved -- not any host keys loaded with load_system_host_keys .
|
set_log_channel(self, name)Set the channel for logging. The default is"paramiko.transport" but it can be set to
anything you want.
|
set_missing_host_key_policy(self, policy)Set the policy to use when connecting to a server that doesn't have a host key in either the system or localHostKeys objects. The default policy is
to reject all unknown servers (using RejectPolicy ). You may substitute AutoAddPolicy or write your own policy
class.
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Mon Jan 21 19:06:09 2008 | http://epydoc.sf.net |