Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect('x.x.x.x', username='user', password='password')
- stdin, stdout, stderr = ssh.exec_command('pwd')
- print stdout.read()
- stdin, stdout, stderr = ssh.exec_command('sudo -i ')
- stdin.write('passwordn')
- stdin, stdout, stderr = ssh.exec_command('pwd')
- print stdout.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement