By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,873 Members | 1,040 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,873 IT Pros & Developers. It's quick & easy.

authentication failed error occured while using paramiko

P: 5
I want to connect to a Windows machine in my network , using ssh, I use paramiko but I have problem in authentication, would you please help me?

1- I have installed freeSSHD in server machine? Is it necessery ? or may I have to install another program?

2- I have entered server's Ip insted of hostname.Is it correct?

3- I have creat a user in server machine with a password to connect. Am I right?

4- I use this code in clinet computer? May I need another code for server computer?
Expand|Select|Wrap|Line Numbers
  1. hostname = "192.168.1.4" 
  2. username = "test" 
  3. port = 22 
  4. password = '123456' 
  5.  
  6. # now connect 
  7. try: 
  8.     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
  9.     sock.connect_ex((hostname, port)) 
  10. except Exception, e: 
  11.     print 'Connect failed: ' + str(e) 
  12.     traceback.print_exc() 
  13.     sys.exit(1) 
  14.  
  15. t = paramiko.Transport(sock) 
  16. event = threading.Event() 
  17. t.start_client(event) 
  18. print "started client" 
  19. event.wait(15) 
  20.  
  21. if not t.is_active(): 
  22.     print 'SSH negotiation failed.' 
  23.     sys.exit(1) 
  24. else: 
  25.     print "SSH negotiation sucessful" 
  26.  
  27. print "doing authentication" 
  28. t.auth_password(username, password, event) 
  29.  
  30.  
  31. event.clear() 
  32. event.wait(20) 
  33.  
the result is :
started client
ssh negotiation sucessful
authentication failed

what should I do?
please help me , I am new in paramiko.
Oct 27 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.