Guest User

Untitled

a guest
Sep 10th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. Paramiko ssh_config parameters
  2. ssh -o ServerAliveInterval=1 -o ServerAliveCountMax=1 <host>
  3.  
  4. >>> import paramiko
  5. >>> client = paramiko.SSHClient()
  6. >>> client.load_system_host_keys()
  7. >>> client.connect(hostname='localhost', port=22, username='user', password='****', timeout=5.0)
  8. >>> sftp = paramiko.SFTPClient.from_transport(client.get_transport())
  9. >>> dirlist = sftp.listdir('.')
  10.  
  11. >>> import paramiko
  12. >>> client = paramiko.SSHClient()
  13. >>> client.load_system_host_keys()
  14. >>> client.connect(hostname='slowhost', username='user', password='****', timeout=1.0)
  15. Traceback (most recent call last):
  16. File "<stdin>", line 1, in <module>
  17. File "/usr/lib/python2.7/site-packages/paramiko/client.py", line 296, in connect
  18. sock.connect(addr)
  19. File "/usr/lib64/python2.7/socket.py", line 222, in meth
  20. return getattr(self._sock,name)(*args)
  21. socket.timeout: timed out
Add Comment
Please, Sign In to add comment