ssh client with paramiko (python) -


# sshpy v1 s0urd # simple ssh client  # irc.gonullyourself.org 6667 #code  import paramiko import os  ssh = paramiko.sshclient() ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) privatekey = os.path.expanduser('/home/rabia/private') mkey = paramiko.rsakey.from_private_key_file(privatekey) ssh.connect('78.46.172.47', port=22, username='s0urd', password=none, pkey=mkey)  while true:       pick = raw_input("sshpy: ")       stdin, stdout, stderr = ssh.exec_command(pick)       print stdout.readlines()          ssh.close() 

when try run more 1 command error:

attributeerror: 'nonetype' object has no attribute 'open_session'

looks it's because @ end of while loop ssh.close() (thus closing session).


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

c# - how to write client side events functions for the combobox items -