Python Language Secure Shell Connection in Python


hostnameThis parameter tells the host to which the connection needs to be established
usernameusername required to access the host
porthost port
passwordpassword for the account

ssh connection

from paramiko import client
ssh = client.SSHClient() # create a new SSHClient object
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #auto-accept unknown host keys
ssh.connect(hostname, username=username, port=port, password=password) #connect with a host
stdin, stdout, stderr = ssh.exec_command(command) # submit a command to ssh
print #tells the status  1 - job failed