Paramiko/SSH blues....

Discussion in 'Python' started by Tarun Kapoor, Jan 16, 2008.

  1. Tarun Kapoor

    Tarun Kapoor Guest

    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
     
    Tarun Kapoor, Jan 16, 2008
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.