T
Tarun Kapoor
I am using paramiko to do an SFTP file transfer... I was able to connect
to the remote server using an SFTP client I have just to make sure
that username and password are working.. But when i try to connect
using this script it fails ....
**hostname, username and password are declared.
# now, connect and use paramiko Transport to negotiate SSH2 across
the connection
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((hostname, port))
t = paramiko.Transport(sock)
event = threading.Event()
t.start_client(event)
event.wait(15)
if not t.is_active():
print 'SSH negotiation failed.'
sys.exit(1)
else:
print "SSH negotiation sucessful"
event.clear()
t.auth_password(username=username, password=password,event=event)
if not t.is_authenticated():
print "not authenticated"
output:
SSH negotiation successful
not authenticated
to the remote server using an SFTP client I have just to make sure
that username and password are working.. But when i try to connect
using this script it fails ....
**hostname, username and password are declared.
# now, connect and use paramiko Transport to negotiate SSH2 across
the connection
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((hostname, port))
t = paramiko.Transport(sock)
event = threading.Event()
t.start_client(event)
event.wait(15)
if not t.is_active():
print 'SSH negotiation failed.'
sys.exit(1)
else:
print "SSH negotiation sucessful"
event.clear()
t.auth_password(username=username, password=password,event=event)
if not t.is_authenticated():
print "not authenticated"
output:
SSH negotiation successful
not authenticated