Why chdir command doesn't work with client.get_transport() ?

Charles_hans charles_hans at yahoo.com
Sun Feb 3 12:58:59 EST 2008


Thank you, Martin! I think that you are right.
But I can't use rsh since I am on XP to send commands to UNIX. I used telnet
before. Now I am converting to ssh/sftp, which is my purpose.

I put some more efforts in the following code:

    t = paramiko.Transport((hostname, port))
    t.connect(username=username, password=password, hostkey=None)
    sftp = t.open_sftp_client()
    sftp.chdir('temp')
    pwd = sftp.getcwd()                       # Successful
    s = t.open_session()
    s.exec_command('ls')
    stdout = s.makefile('rb')
    for line in stdout:
        print '... ' + line.strip('\n')             # Find: the default
directory shown

This means the channel s created above has nothing to do with the sftp
client which successfully changed the pwd. Any idea that we can link s and
sftp together?  Thanks!

I can't find something equivalent to Telnet in paramiko.

Charles
2/3/2008



-- 
View this message in context: http://www.nabble.com/Why-chdir-command-doesn%27t-work-with-client.get_transport%28%29---tp15248798p15256088.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list