Created
November 18, 2014 01:39
-
-
Save ulissescastro/a6e5ad4b090f0903117e to your computer and use it in GitHub Desktop.
Fix Paramiko TTY (sudo)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python26 | |
| import paramiko | |
| ssh = paramiko.SSHClient() | |
| ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
| ssh.connect(hostname='10.10.10.10', port=22, username='user', password='xxx') | |
| chan = ssh.get_transport().open_session() | |
| chan.get_pty() | |
| chan.exec_command('sudo su -c "id"') | |
| print(chan.recv(1024)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment