Establishes an SSH connection to a remote host using either password
or private key authentication. Once established, this object allows
executing commands, copying files to/from the remote host, various file
querying similar to os.path.*, and much more.
|
__init__(self,
host,
username=None,
password=None,
private_key=None,
private_key_pass=None,
port=22,
timeout=30)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
load_private_key(self,
private_key,
private_key_pass=None) |
source code
|
|
|
connect(self,
host=None,
username=None,
password=None,
private_key=None,
private_key_pass=None,
port=22,
timeout=30) |
source code
|
|
|
|
|
|
|
|
|
_load_rsa_key(self,
private_key,
private_key_pass=None) |
source code
|
|
|
_load_dsa_key(self,
private_key,
private_key_pass=None) |
source code
|
|
|
|
|
|
|
load_remote_rsa_key(self,
remote_filename)
Returns paramiko.RSAKey object for an RSA key located on the remote
machine |
source code
|
|
|
makedirs(self,
path,
mode=493)
Same as os.makedirs - makes a new directory and automatically creates
all parent directories if they do not exist. |
source code
|
|
|
mkdir(self,
path,
mode=493,
ignore_failure=False)
Make a new directory on the remote machine |
source code
|
|
|
|
|
remove_lines_from_file(self,
remote_file,
regex)
Removes lines matching regex from remote_file |
source code
|
|
|
|
|
remote_file(self,
file,
mode=' w ' )
Returns a remote file descriptor |
source code
|
|
|
|
|
chown(self,
uid,
gid,
remote_file)
Apply permissions (mode) to remote_file |
source code
|
|
|
chmod(self,
mode,
remote_file)
Apply permissions (mode) to remote_file |
source code
|
|
|
ls(self,
path)
Return a list containing the names of the entries in the remote path. |
source code
|
|
|
isdir(self,
path)
Return true if the remote path refers to an existing directory. |
source code
|
|
|
isfile(self,
path)
Return true if the remote path refers to an existing file. |
source code
|
|
|
stat(self,
path)
Perform a stat system call on the given remote path. |
source code
|
|
|
get(self,
remotepath,
localpath=None)
Copies a file between the remote host and the local host. |
source code
|
|
|
put(self,
localpath,
remotepath=None)
Copies a file between the local host and the remote host. |
source code
|
|
|
|
|
execute(self,
command,
silent=True,
only_printable=False,
ignore_exit_status=False,
log_output=True)
Execute a remote command and return stdout/stderr |
source code
|
|
|
has_required(self,
progs)
Same as check_required but returns False if not all commands exist |
source code
|
|
|
|
|
|
|
get_path(self)
Returns the PATH environment variable on the remote machine |
source code
|
|
|
get_env(self)
Returns the remote machine's environment as a dictionary |
source code
|
|
|
close(self)
Closes the connection and cleans up. |
source code
|
|
|
|
|
|
|
|
|
__del__(self)
Attempt to clean up if not explicitly closed. |
source code
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|