Welcome to Paramiko’s documentation!¶
This site covers Paramiko’s usage & API documentation. For basic info on what Paramiko is, including its public changelog & how the project is maintained, please see the main project website.
API documentation¶
The high-level client API starts with creation of an SSHClient
object. For
more direct control, pass a socket (or socket-like object) to a Transport
,
and use start_server
or start_client
to negotiate with the remote host as either a server
or client.
As a client, you are responsible for authenticating using a password or private key, and checking the server’s host key. (Key signature and verification is done by paramiko, but you will need to provide private keys and check that the content of a public key matches what you expected to see.)
As a server, you are responsible for deciding which users, passwords, and keys to allow, and what kind of channels to allow.
Once you have finished, either side may request flow-controlled channels
to the other side, which are Python objects that act like sockets,
but send and receive data over the encrypted session.
For details, please see the following tables of contents (which are organized by area of interest.)
Core SSH protocol classes¶
- Channel
Channel
Channel.__init__()
Channel.__repr__()
Channel.active
Channel.chanid
Channel.close()
Channel.closed
Channel.exec_command()
Channel.exit_status_ready()
Channel.fileno()
Channel.get_id()
Channel.get_name()
Channel.get_pty()
Channel.get_transport()
Channel.getpeername()
Channel.gettimeout()
Channel.invoke_shell()
Channel.invoke_subsystem()
Channel.makefile()
Channel.makefile_stderr()
Channel.makefile_stdin()
Channel.recv()
Channel.recv_exit_status()
Channel.recv_ready()
Channel.recv_stderr()
Channel.recv_stderr_ready()
Channel.remote_chanid
Channel.request_forward_agent()
Channel.request_x11()
Channel.resize_pty()
Channel.send()
Channel.send_exit_status()
Channel.send_ready()
Channel.send_stderr()
Channel.sendall()
Channel.sendall_stderr()
Channel.set_combine_stderr()
Channel.set_environment_variable()
Channel.set_name()
Channel.setblocking()
Channel.settimeout()
Channel.shutdown()
Channel.shutdown_read()
Channel.shutdown_write()
Channel.transport
Channel.update_environment()
ChannelFile
ChannelStderrFile
ChannelStdinFile
open_only()
- Client
SSHClient
SSHClient.__init__()
SSHClient.load_system_host_keys()
SSHClient.load_host_keys()
SSHClient.save_host_keys()
SSHClient.get_host_keys()
SSHClient.set_log_channel()
SSHClient.set_missing_host_key_policy()
SSHClient.connect()
SSHClient.close()
SSHClient.exec_command()
SSHClient.invoke_shell()
SSHClient.open_sftp()
SSHClient.get_transport()
MissingHostKeyPolicy
AutoAddPolicy
RejectPolicy
WarningPolicy
- Message
Message
Message.__init__()
Message.__repr__()
Message.__weakref__
Message.add()
Message.add_adaptive_int()
Message.add_boolean()
Message.add_byte()
Message.add_bytes()
Message.add_int()
Message.add_int64()
Message.add_list()
Message.add_mpint()
Message.add_string()
Message.asbytes()
Message.get_adaptive_int()
Message.get_binary()
Message.get_boolean()
Message.get_byte()
Message.get_bytes()
Message.get_int()
Message.get_int64()
Message.get_list()
Message.get_mpint()
Message.get_remainder()
Message.get_so_far()
Message.get_string()
Message.get_text()
Message.rewind()
- Packetizer
NeedRekeyException
Packetizer
Packetizer.__init__()
Packetizer.__weakref__
Packetizer.complete_handshake()
Packetizer.handshake_timed_out()
Packetizer.need_rekey()
Packetizer.read_all()
Packetizer.read_message()
Packetizer.readline()
Packetizer.send_message()
Packetizer.set_inbound_cipher()
Packetizer.set_keepalive()
Packetizer.set_log()
Packetizer.set_outbound_cipher()
Packetizer.start_handshake()
- Transport
Transport
Transport.__init__()
Transport.__repr__()
Transport.atfork()
Transport.get_security_options()
Transport.set_gss_host()
Transport.start_client()
Transport.start_server()
Transport.add_server_key()
Transport.get_server_key()
Transport.load_server_moduli()
Transport.close()
Transport.get_remote_server_key()
Transport.is_active()
Transport.open_session()
Transport.open_x11_channel()
Transport.open_forward_agent_channel()
Transport.open_forwarded_tcpip_channel()
Transport.open_channel()
Transport.request_port_forward()
Transport.cancel_port_forward()
Transport.open_sftp_client()
Transport.send_ignore()
Transport.renegotiate_keys()
Transport.set_keepalive()
Transport.global_request()
Transport.accept()
Transport.connect()
Transport.get_exception()
Transport.set_subsystem_handler()
Transport.is_authenticated()
Transport.get_username()
Transport.get_banner()
Transport.auth_none()
Transport.auth_password()
Transport.auth_publickey()
Transport.auth_interactive()
Transport.auth_interactive_dumb()
Transport.auth_gssapi_with_mic()
Transport.auth_gssapi_keyex()
Transport.set_log_channel()
Transport.get_log_channel()
Transport.set_hexdump()
Transport.get_hexdump()
Transport.use_compression()
Transport.getpeername()
Transport.run()
SecurityOptions
ServiceRequestingTransport
ServiceRequestingTransport.__init__()
ServiceRequestingTransport.auth_none()
ServiceRequestingTransport.auth_password()
ServiceRequestingTransport.auth_publickey()
ServiceRequestingTransport.auth_interactive()
ServiceRequestingTransport.auth_interactive_dumb()
ServiceRequestingTransport.auth_gssapi_with_mic()
ServiceRequestingTransport.auth_gssapi_keyex()
Authentication & keys¶
- Authentication modules
- SSH agents
Agent
AgentClientProxy
AgentKey
AgentKey.algorithm_name
AgentKey.asbytes()
AgentKey.can_sign()
AgentKey.fingerprint
AgentKey.from_path()
AgentKey.from_private_key()
AgentKey.from_private_key_file()
AgentKey.from_type_string()
AgentKey.get_base64()
AgentKey.get_bits()
AgentKey.get_fingerprint()
AgentKey.get_name()
AgentKey.identifiers()
AgentKey.load_certificate()
AgentKey.sign_ssh_data()
AgentKey.verify_ssh_sig()
AgentKey.write_private_key()
AgentKey.write_private_key_file()
AgentLocalProxy
AgentLocalProxy.daemon
AgentLocalProxy.getName()
AgentLocalProxy.get_connection()
AgentLocalProxy.ident
AgentLocalProxy.isDaemon()
AgentLocalProxy.is_alive()
AgentLocalProxy.join()
AgentLocalProxy.name
AgentLocalProxy.native_id
AgentLocalProxy.run()
AgentLocalProxy.setDaemon()
AgentLocalProxy.setName()
AgentLocalProxy.start()
AgentProxyThread
AgentProxyThread.daemon
AgentProxyThread.getName()
AgentProxyThread.ident
AgentProxyThread.isDaemon()
AgentProxyThread.is_alive()
AgentProxyThread.join()
AgentProxyThread.name
AgentProxyThread.native_id
AgentProxyThread.run()
AgentProxyThread.setDaemon()
AgentProxyThread.setName()
AgentProxyThread.start()
AgentRemoteProxy
AgentRemoteProxy.daemon
AgentRemoteProxy.getName()
AgentRemoteProxy.ident
AgentRemoteProxy.isDaemon()
AgentRemoteProxy.is_alive()
AgentRemoteProxy.join()
AgentRemoteProxy.name
AgentRemoteProxy.native_id
AgentRemoteProxy.run()
AgentRemoteProxy.setDaemon()
AgentRemoteProxy.setName()
AgentRemoteProxy.start()
AgentRequestHandler
AgentServerProxy
get_agent_connection()
- Host keys /
known_hosts
files - Key handling
- Parent key class
PKey
PKey.__eq__()
PKey.__hash__()
PKey.__init__()
PKey.__repr__()
PKey.__weakref__
PKey.algorithm_name
PKey.asbytes()
PKey.can_sign()
PKey.fingerprint
PKey.from_path()
PKey.from_private_key()
PKey.from_private_key_file()
PKey.from_type_string()
PKey.get_base64()
PKey.get_bits()
PKey.get_fingerprint()
PKey.get_name()
PKey.identifiers()
PKey.load_certificate()
PKey.sign_ssh_data()
PKey.verify_ssh_sig()
PKey.write_private_key()
PKey.write_private_key_file()
PublicBlob
UnknownKeyType
- DSA (DSS)
- RSA
- ECDSA
- Ed25519
- Parent key class
- GSS-API authentication
- GSS-API key exchange
Other primary functions¶
- Configuration
ProxyCommand
support- Server implementation
ServerInterface
ServerInterface.check_channel_request()
ServerInterface.get_allowed_auths()
ServerInterface.check_auth_none()
ServerInterface.check_auth_password()
ServerInterface.check_auth_publickey()
ServerInterface.check_auth_interactive()
ServerInterface.check_auth_interactive_response()
ServerInterface.check_auth_gssapi_with_mic()
ServerInterface.check_auth_gssapi_keyex()
ServerInterface.enable_auth_gssapi()
ServerInterface.check_port_forward_request()
ServerInterface.cancel_port_forward_request()
ServerInterface.check_global_request()
ServerInterface.check_channel_pty_request()
ServerInterface.check_channel_shell_request()
ServerInterface.check_channel_exec_request()
ServerInterface.check_channel_subsystem_request()
ServerInterface.check_channel_window_change_request()
ServerInterface.check_channel_x11_request()
ServerInterface.check_channel_forward_agent_request()
ServerInterface.check_channel_direct_tcpip_request()
ServerInterface.check_channel_env_request()
ServerInterface.get_banner()
ServerInterface.__weakref__
InteractiveQuery
SubsystemHandler
- SFTP
SFTPError
int64
SFTP
SFTPClient
SFTPClient.__init__()
SFTPClient.chdir()
SFTPClient.chmod()
SFTPClient.chown()
SFTPClient.close()
SFTPClient.file()
SFTPClient.from_transport()
SFTPClient.get()
SFTPClient.get_channel()
SFTPClient.getcwd()
SFTPClient.getfo()
SFTPClient.listdir()
SFTPClient.listdir_attr()
SFTPClient.listdir_iter()
SFTPClient.lstat()
SFTPClient.mkdir()
SFTPClient.normalize()
SFTPClient.open()
SFTPClient.posix_rename()
SFTPClient.put()
SFTPClient.putfo()
SFTPClient.readlink()
SFTPClient.remove()
SFTPClient.rename()
SFTPClient.rmdir()
SFTPClient.stat()
SFTPClient.symlink()
SFTPClient.truncate()
SFTPClient.unlink()
SFTPClient.utime()
SFTPServer
SFTPAttributes
SFTPFile
SFTPFile.check()
SFTPFile.chmod()
SFTPFile.chown()
SFTPFile.close()
SFTPFile.flush()
SFTPFile.gettimeout()
SFTPFile.prefetch()
SFTPFile.read()
SFTPFile.readable()
SFTPFile.readinto()
SFTPFile.readline()
SFTPFile.readlines()
SFTPFile.readv()
SFTPFile.seek()
SFTPFile.seekable()
SFTPFile.set_pipelined()
SFTPFile.setblocking()
SFTPFile.settimeout()
SFTPFile.stat()
SFTPFile.tell()
SFTPFile.truncate()
SFTPFile.utime()
SFTPFile.writable()
SFTPFile.write()
SFTPFile.writelines()
SFTPFile.xreadlines()
SFTPHandle
SFTPServerInterface
SFTPServerInterface.__init__()
SFTPServerInterface.__weakref__
SFTPServerInterface.canonicalize()
SFTPServerInterface.chattr()
SFTPServerInterface.list_folder()
SFTPServerInterface.lstat()
SFTPServerInterface.mkdir()
SFTPServerInterface.open()
SFTPServerInterface.posix_rename()
SFTPServerInterface.readlink()
SFTPServerInterface.remove()
SFTPServerInterface.rename()
SFTPServerInterface.rmdir()
SFTPServerInterface.session_ended()
SFTPServerInterface.session_started()
SFTPServerInterface.stat()
SFTPServerInterface.symlink()
Miscellany¶
- Buffered pipes
- Buffered files
BufferedFile
BufferedFile.__init__()
BufferedFile.__iter__()
BufferedFile.__next__()
BufferedFile.close()
BufferedFile.flush()
BufferedFile.read()
BufferedFile.readable()
BufferedFile.readinto()
BufferedFile.readline()
BufferedFile.readlines()
BufferedFile.seek()
BufferedFile.seekable()
BufferedFile.tell()
BufferedFile.writable()
BufferedFile.write()
BufferedFile.writelines()
BufferedFile.xreadlines()
- Cross-platform pipe implementations
- Exceptions