The sshutil.conn Module

class sshutil.conn.SSHClientSession(host, port, subsystem, username=None, password=None, debug=False, cache=None, proxycmd=None)

Bases: sshutil.conn.SSHSession

A client session to a host using a subsystem.

class sshutil.conn.SSHCommandSession(host, port, command, username=None, password=None, debug=False, cache=None, proxycmd=None)

Bases: sshutil.conn.SSHSession

A client session to a host using a command i.e., like a remote pipe

Objects of this class are useful for long running commands. For run-to-completion commands SSHCommand should be used.

recv_exit_status()
class sshutil.conn.SSHConnection(host, port=22, username=None, password=None, debug=False, cache=None, proxycmd=None)

Bases: object

A connection to an SSH server

close()
is_active()
class sshutil.conn.SSHSession(host, port=22, username=None, password=None, debug=False, cache=None, proxycmd=None)

Bases: sshutil.conn.SSHConnection

recv(size=16384)
recv_ready()
recv_stderr(size=16384)
recv_stderr_ready()
send(chunk)
sendall(chunk)
sshutil.conn.shell_escape_single_quote(command)

Escape single quotes for use in a shell single quoted string Explanation:

  1. End first quotation which uses single quotes.
  2. Start second quotation, using double-quotes.
  3. Quoted character.
  4. End second quotation, using double-quotes.
  5. Start third quotation, using single quotes.

If you do not place any whitespaces between (1) and (2), or between (4) and (5), the shell will interpret that string as a one long word