Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- ssh_client =paramiko.SSHClient()
- ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- sh_client.connect(hostname='<IP>', username='root', password='<passwd>')
- stdin, stdout, stderr = ssh_client.exec_command('su - service_user')
- stdin, stdout, stderr = ssh_client.exec_command('whoami')
- stdout.readlines()
Add Comment
Please, Sign In to add comment