API documentation for common single host client functionality.

This class is abstract and contains functions that need to be implemented for each underlying SSH library.

class pssh.clients.base.single.BaseSSHClient(host, user=None, password=None, port=None, pkey=None, num_retries=3, retry_delay=5, allow_agent=True, timeout=None, proxy_host=None, proxy_port=None, _auth_thread_pool=True, identity_auth=True)
copy_file(local_file, remote_file, recurse=False, sftp=None, _dir=None)
copy_remote_file(remote_file, local_file, recurse=False, sftp=None, encoding='utf-8')
execute(cmd, use_pty=False, channel=None)
mkdir(sftp, directory, _parent_path=None)
read_output(channel, timeout=None)
read_output_buffer(output_buffer, prefix=None, callback=None, callback_args=None, encoding='utf-8')

Read from output buffers and log to host_logger.

  • output_buffer (iterator) – Iterator containing buffer

  • prefix (str) – String to prefix log output to host_logger with

  • callback (function) – Function to call back once buffer is depleted:

  • callback_args (tuple) – Arguments for call back function

read_stderr(channel, timeout=None)
run_command(command, sudo=False, user=None, use_pty=False, shell=None, encoding='utf-8', timeout=None, read_timeout=None)

Run remote command.

  • command (str) – Command to run.

  • sudo (bool) – Run command via sudo as super-user.

  • user (str) – Run command as user via sudo

  • use_pty (bool) – Whether or not to obtain a PTY on the channel.

  • shell (str) – (Optional) Override shell to use to run command with. Defaults to login user’s defined shell. Use the shell’s command syntax, eg shell=’bash -c’ or shell=’zsh -c’.

  • encoding (str) – Encoding to use for output. Must be valid Python codec

  • read_timeout (float) – (Optional) Timeout in seconds for reading output.

Return type


scp_recv(remote_file, local_file, recurse=False, sftp=None, encoding='utf-8')
scp_send(local_file, remote_file, recurse=False, sftp=None)
sftp_get(sftp, remote_file, local_file)
sftp_put(sftp, local_file, remote_file)
wait_finished(channel, timeout=None)
IDENTITIES = ('/home/docs/.ssh/id_rsa', '/home/docs/.ssh/id_dsa', '/home/docs/.ssh/identity', '/home/docs/.ssh/id_ecdsa', '/home/docs/.ssh/id_ed25519')