Advertisement
Guest User

Untitled

a guest
May 3rd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import paramiko
  4.  
  5. hostname = '192.168.1.1'
  6. port = 22
  7. username = 'foo'
  8. password = 'xxxYYYxxx'
  9.  
  10. if __name__ == "__main__":
  11. #paramiko.util.log_to_file('paramiko.log')
  12. s = paramiko.SSHClient()
  13. #s.load_system_host_keys()
  14. s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # use this
  15. s.connect(hostname, port, username, password)
  16. stdin, stdout, stderr = s.exec_command('pwd')
  17. print stdout.read()
  18. s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement