Guest User

Untitled

a guest
Dec 6th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. import paramiko
  2. ssh_client =paramiko.SSHClient()
  3. ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  4. sh_client.connect(hostname='<IP>', username='root', password='<passwd>')
  5.  
  6. stdin, stdout, stderr = ssh_client.exec_command('su - service_user')
  7. stdin, stdout, stderr = ssh_client.exec_command('whoami')
  8. stdout.readlines()
Add Comment
Please, Sign In to add comment