Was trying to SSH from one linux server to another using Paramiko library but getting the
import sys
import paramiko
hostname ="****"
password="no password provided"
source=""
username="***"
port=22
key_file_path="/root/.ssh/id_rsa"
#printing key
file=open(key_file_path,"r")
print file.read()
try:
ssh=paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname,port,username,password,key_filename=key_file_path,passphrase=None)
#ssh_session=ssh.get_transport().open_session()
stdin,stdout,stderr = ssh.exec_command('uptime')
output=stdout.readlines()
error=stderr.readlines()
print("STDOUT output")
print(output)
print("output object type")
type(output)
print("STDERR output")
print(error)
except Exception, e:
print e
print "exception occoured"
Output :-
STDOUT output :- []
output object type :-
STDERR output [u'Connecting to **.**.**.***:****\r\n']
As I am new so i have searched all over the net and have build till this point but I'm stuck at this point and not finding as to why is the error please can anyone help me.....
And also have viewed all related questions but couldn't find as to why the error is occouring...
pwd? Do you know where does the "Connecting to ..." message come from?uptimecommand.