Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ktechmidas/c37e98a0beb65e281628c26110f665f1 to your computer and use it in GitHub Desktop.
Save ktechmidas/c37e98a0beb65e281628c26110f665f1 to your computer and use it in GitHub Desktop.
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: Traceback (most recent call last):
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py", line 1749, in run
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: self._check_banner()
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py", line 1897, in _check_banner
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: raise SSHException('Error reading SSH protocol banner' + str(e))
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: SSHException: Error reading SSH protocol banner
ERR [20170407-19:12:19.894] thr=134 paramiko.transport:
DEB [20170407-19:12:22.458] thr=3 paramiko.transport: Received global request "[email protected]"
DEB [20170407-19:12:22.458] thr=3 paramiko.transport: Rejecting "[email protected]" global request from server.
-----------
def simple_ssh(ip,runcmd):
paramiko.util.log_to_file("ssh.log")
k = paramiko.RSAKey.from_private_key_file('/root/cluster/ibb-korea.pem')
ssh=paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(ip,username='core',pkey = k)
stdin,stdout,stderr = ssh.exec_command(runcmd)
except:
print "Failed to connect"
return 10
time.sleep(3)
return stdout.readlines()
-----------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment