Last active
August 29, 2015 14:02
-
-
Save copyleftdev/0b482ff8f3976291b555 to your computer and use it in GitHub Desktop.
Python SHH
This file contains 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
import paramiko | |
cmd = "uname -r" | |
host = 'dev' | |
user = 'username' | |
passwd = 'password' | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
ssh.connect(host, username=user,password=passwd) | |
stdin, stdout, stderr = ssh.exec_command(cmd) | |
#stdin.write(passwd + '\n') | |
stdin.flush() | |
print stdout.readlines() | |
ssh.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment