Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #! python
  2.  
  3. import paramiko
  4. import time
  5. ssh = paramiko.SSHClient()
  6. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  7. print("ok1")
  8. ssh.connect('10.20.7.104', username='user1', password='passbkcuser')
  9. #time.sleep(5)
  10. print("logOn")
  11. stdin, stdout, stderr = ssh.exec_command("sudo -S reboot")
  12. time.sleep(5)
  13. stdin.write("passbkcuser\n")
  14. #time.sleep(5)
  15. print("command done")
  16. stdin.flush()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement