In [13]:
import SSHTools as SSHTools
ssh=SSHTools.SSHTools()
In [14]:
# Setup connection parameters (for tunneling use host="localhost")
ssh.setup(user="Andriy.Zhugayevych",host="cluster.skoltech.ru",pkey="C:/Users/azh/Sys/Internet/SSH/skoltech/key2.ppk")
#ssh.setup(user="Sergey.Matveev",host="cluster.skoltech.ru",pkey="/home/smatveev/.ssh/T1700")
#ssh.setup(user='s.matveev',host='83.149.206.202',pkey='/home/sergey/.ssh/id_rsa',port=22)
In [15]:
# Test connection: execute a command on the server
ssh.run("ls",printout=True)
Out[15]:
In [16]:
ssh.run("ls aaaaaa") # deliberately wrong
In [17]:
ssh.run("ls aaaaaa",noerror=True)
Out[17]:
In [18]:
# File upload/download
ssh.put("SSHTools.py","test_put")
ssh.sget("gaussian/_pbs","test_sget")
Out[18]:
In [19]:
# Remove test file
ssh.run("rm -f test_put")
Out[19]:
In [20]:
print(ssh.fexists('gaussian/_pbs'))
print(ssh.fexists('gaussian/_bs'))