Forums

when i use parimiko to establish a shell connection with a unix machine on port 22 the connection failed

when i use parimiko to establish a shell connection with a unix machine on port 22 the connection is failing with the error ( [Errno 10061] No connection could be made because the target machine actively refused it) But when i use putty i can connect to the same machine with same port and credentials. What could be the reason?

transport = paramiko.Transport((host, port))

2520 2424 2014-01-07 18:45:21,154 ERROR "Exception in Unix VM discovery Function" at line 176 in UnixVMDiscovery Traceback (most recent call last): File "C:\Program Files\UnixHelper.py", line 157, in UnixVMDiscovery sshConn=remoteconnection.Connection(_VM, OS="unix", username=Username, password=Password) File "C:\Program Files\remoteconnection.py", line 1124, in init self._transport = paramiko.Transport((host, port)) File "C:\Program Files\paramiko\transport.py", line 296, in init sock.connect((hostname, port)) File "<string>", line 1, in connect error: [Errno 10061] No connection could be made because the target machine actively refused it

That'll be because you have a free account. Only paid accounts get unfettered internet access.

I did not get which account you meant ?

If you upgrade to a "Hacker" account ($5/month) you get unlimited internet access.

Free accounts only get HTTP access to whitelisted sites.

@kloganathan, the file paths in that traceback suggest that you're running on a Windows machine and not from PythonAnywhere. My guess is that Putty is using one kind of authentication and paramiko is using another. Check the Putty settings and try to replicate them in Paramiko.

Even if i try from command prompt it is not working

import paramiko C:\Python26\lib\site-packages\Crypto\Hash\SHA.py:6: DeprecationWarning: the sha module is deprecated; use the hashlib module instead from sha import * C:\Python26\lib\site-packages\Crypto\Hash\MD5.py:6: DeprecationWarning: the md5 module is deprecated; use hashlib instead from md5 import * paramiko.Transport(("niraj-rhel5", 22)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Program Files\CommVault\Simpana\AutomationPackage\ScriptsLibrary\para miko\transport.py", line 296, in init sock.connect((hostname, port)) File "<string>", line 1, in connect socket.error: [Errno 10061] No connection could be made because the target machi ne actively refused it

@kloganathan -- sorry, nothing springs to mind. Just to clarify -- these forums are for the discussion of PythonAnywhere, an online Python development and hosting environment, and it looks like you're asking about how to connect to another machine from your own local machine, so while we'd like to help, there's not really that much we can do.