ssh problem using paramiko?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sa6113

    ssh problem using paramiko?


    I use this code :


    import paramiko
    import socket

    hostname = "192.168.1. 4"
    username = "test"
    port = 22
    password = ''123456"

    # now connect
    try:
    sock = socket.socket(s ocket.AF_INET, socket.SOCK_STR EAM)
    sock.connect((h ostname, port))
    except Exception, e:
    print 'Connect failed: ' + str(e)
    traceback.print _exc()
    sys.exit(1)

    ------------------
    and I got this error :
    sock.connect((h ostname, port))
    File "<string>", line 1 , in connect
    error:(10061 ,'Connection refused')
    -------------------
    what is the problem?
    I have a computer with this Ip and username , password in my network.
    Do I have to install ssh or somthing else in that computer(server ) or run
    any script?


    --
    View this message in context: http://www.nabble.com/ssh-problem-us...p19857268.html
    Sent from the Python - python-list mailing list archive at Nabble.com.

  • Johny

    #2
    Re: ssh problem using paramiko?

    On Oct 7, 2:40 pm, sa6113 <s.payan...@gma il.comwrote:
    I use this code :
    >
    import paramiko
    import socket
    >
    hostname = "192.168.1. 4"
    username = "test"
    port = 22
    password = ''123456"
    >
    # now connect
    try:
    sock = socket.socket(s ocket.AF_INET, socket.SOCK_STR EAM)
    sock.connect((h ostname, port))
    except Exception, e:
    print 'Connect failed: ' + str(e)
    traceback.print _exc()
    sys.exit(1)
    >
    ------------------
    and I got this error :
    sock.connect((h ostname, port))
    File "<string>", line 1 , in connect
    error:(10061 ,'Connection refused')
    -------------------
    what is the problem?
    I have a computer with this Ip and username , password in my network.
    Do I have to install ssh or somthing else in that computer(server ) or run
    any script?
    >
    --
    View this message in context:http://www.nabble.com/ssh-problem-us...57268p19857268...
    Sent from the Python - python-list mailing list archive at Nabble.com.
    Why do not use only Paramiko

    import paramiko

    t = paramiko.Transp ort((Myserver, 22))
    t.start_client( )
    t.auth_password (Login,'Passwor d)

    chan = t.open_session( )



    Comment

    Working...