On Jan 16, 11:38 am, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > 2008/1/16, Tarun Kapoor <[EMAIL PROTECTED]>: > > > > > # 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) > > t.start_client() > > key = t.get_remote_server_key() > > > event = threading.Event() > > t.auth_password(username=username, password=password, event=event) > > event.wait() > > > if not t.is_authenticated(): > > print "not authenticated" > > > output: > > not authenticated > > This is a different problem I guess, now you are usin get_remote_server_key. > And why are you creating event after calling start_client without > specifying it ? > > > > > > > On Jan 16, 11:11 am, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > > > 2008/1/16, Tarun Kapoor <[EMAIL PROTECTED]>: > > > > > 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.. This is the code. > > > > > # 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 > > > > > Tarun > > > > > Waterstone Capital Management > > > > > 2 Carlson Parkway, Suite 260 > > > > > Plymouth, MN 55447 > > > > > Direct: 952-697-4123 > > > > > Cell: 612-205-2587 > > > > Disclaimer This e-mail and any attachments is confidential and intended > > > > solely for the use of the individual(s) to whom it is addressed. Any > > > > views > > > > or opinions presented are solely those of the author and do not > > > > necessarily > > > > represent those of Waterstone Capital Management, L.P and affiliates. > > > > If you > > > > are not the intended recipient, be advised that you have received this > > > > e-mail in error and that any use, dissemination, printing, forwarding or > > > > copying of this email is strictly prohibited. Please contact the sender > > > > if > > > > you have received this e-mail in error. You should also be aware that > > > > e-mails are susceptible to interference and you should not assume that > > > > the > > > > contents of this e-mail originated from the sender above or that they > > > > have > > > > been accurately reproduced in their original form. Waterstone Capital > > > > Management, L.P. and affiliates accepts no responsibility for > > > > information, > > > > or errors or omissions in this e-mail or use or misuse thereof. If in > > > > doubt, > > > > please verify the authenticity with the sender. > > > > -- > > > >http://mail.python.org/mailman/listinfo/python-list > > > > You are missing an event.wait() after t.auth_password. > > > Also, why are you passing this magic value "15" to event.wait() ? That > > > parameter is passed to class _Verbose to indicate if debug messages > > > should be displayed or not, so typical values would be 0/1 or > > > False/True. > > > > -- > > > -- Guilherme H. Polo Goncalves > > > -- > >http://mail.python.org/mailman/listinfo/python-list > > -- > -- Guilherme H. Polo Goncalves
ok here is the problem... I don't know what is the correct way... The only demos i have from the paramiko library use a hostkeyfile. since i don't have that i thought i would use the get_remote_key to get the key and then connect it using the code in the demo.. But clearly nothing is working...I should not HAVE to use the key since i should be able to authenticate using the password... Can you please suggest the right way to go ? Thanks for your time ! -- http://mail.python.org/mailman/listinfo/python-list