Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import paramiko
  2.  
  3. remote_machine_name = raw_input('Enter the remote machine name:')
  4.  
  5. ssh = paramiko.SSHClient()
  6. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  7. try:
  8. ssh.connect(remote_machine_name, username='xxx', password='yyy')
  9. print "connected successfully!"
  10.  
  11. except paramiko.SSHException:
  12. print "connection error"
  13.  
  14. stdin, stdout, stderr = ssh.exec_command('(cd path;./shellscript.sh)')
  15.  
  16. print "stderr: ", stderr.readlines()
  17. print "stdout: ", stdout.readlines()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement