ssh.session

class ssh.session.Session

Libssh session class providing session related functions.

accept_forward(self, int timeout, int dest_port)
blocking_flush(self, int timeout)
cancel_forward(self, address, int port)
channel_new(self)
connect(self)
connector_new(self)
copy_options(self, Session destination)
disconnect(self)

No-op. Handled by object de-allocation.

dump_knownhost(self)
get_cipher_in(self)
get_cipher_out(self)
get_clientbanner(self)
get_disconnect_message(self)
get_error(self)
get_error_code(self)
get_fd(self)
get_hmac_in(self)
get_hmac_out(self)
get_issue_banner(self)
get_kex_algo(self)
get_openssh_version(self)
get_poll_flags(self)
get_server_publickey(self)
get_serverbanner(self)
get_status(self)
get_version(self)
gssapi_set_creds(self, creds)
is_blocking(self)
is_connected(self)
is_server_known(self)
listen_forward(self, address, int port, int bound_port)
options_get(self, Option option)

Get option value. This function can only be used for string optinos. For numeric or other options use the individual functions.

options_get_port(self, unsigned int port_target)
options_getopt(self)
options_parse_config(self, filepath)
options_set(self, Option option, value)

Set an option for session. This function can only be used for string options like host. For numeric options, port etc, use the individual functions.

Parameters

option (ssh.options.Option) – An SSH option object from one of ssh.options.

options_set_gssapi_delegate_credentials(self, bool delegate)

Set delegating credentials to server on/off.

Parameters

delegate (bool) – Delegation on/off

options_set_port(self, int port)
scp_new(self, int mode, location)

Create and initialise SCP channel

send_debug(self, bytes message, int always_display)
send_ignore(self, bytes data)
service_request(self, bytes service)
set_agent_channel(self, Channel channel)
set_agent_socket(self, socket)
set_blocking(self, int blocking)
set_counters(self, scounter, rcounter)
set_fd_except(self)
set_fd_toread(self)
set_fd_towrite(self)
set_socket(self, socket)

Set socket to use for session.

Not part of libssh API but needs to be done in C to be able to translate python sockets to file descriptors to be used by libssh.

sftp_init(self)

Convenience function for creating and initialising new SFTP session.

Not part of libssh API.

sftp_new(self)
silent_disconnect(self)
userauth_agent(self, username)
userauth_gssapi(self)
userauth_kbdint(self, username, submethods)
userauth_kbdint_getanswer(self, unsigned int i)
userauth_kbdint_getinstruction(self)
userauth_kbdint_getname(self)
userauth_kbdint_getnanswers(self)
userauth_kbdint_getnprompts(self)
userauth_kbdint_getprompt(self, unsigned int i, bytes echo)
userauth_kbdint_setanswer(self, unsigned int i, bytes answer)
userauth_list(self)
userauth_none(self)
userauth_password(self, username, password)
userauth_publickey(self, SSHKey privkey)
userauth_publickey_auto(self, passphrase)
userauth_try_publickey(self, SSHKey pubkey)
write_knownhost(self)
sock