Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import paramiko
  2. ssh = paramiko.SSHClient()
  3. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  4. ssh.connect('x.x.x.x', username='user', password='password')
  5. stdin, stdout, stderr = ssh.exec_command('pwd')
  6. print stdout.read()
  7. stdin, stdout, stderr = ssh.exec_command('sudo -i ')
  8. stdin.write('passwordn')
  9. stdin, stdout, stderr = ssh.exec_command('pwd')
  10. print stdout.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement