1import paramiko
2client=paramiko.SSHClient()
3client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
4com="ls ~/desktop"
5client.connect('MyIPAddress',MyPortNumber, username='username', password='password')
6output=""
7stdin, stdout, stderr = client.exec_command(com)
8
9print "ssh succuessful. Closing connection"
10stdout=stdout.readlines()
11client.close()
12print "Connection closed"
13
14print stdout
15print com
16for line in stdout:
17 output=output+line
18if output!="":
19 print output
20else:
21 print "There was no output for this command"
22