Gary Richards
Thu, 12 Nov 2009 00:23:55 -0800
Hi,I've recently been trying to script up downloading some files from an sftp server, but am seeing some very strange differences between using lftp and using sftp. I wonder if someone can see what i'm doing wrongly with lftp. Example below:
[r...@abcd ~]# sftp -o "IdentityFile=/home/send/sshprivatekey" usern...@x.x.x.x
Connecting to x.x.x.x... sftp> ls HomeDirA HomeDirB sftp> cd / sftp> ls RootDirA RootDirBThe above works as expected, in my home directory I see some directories. If I cd /, then ls again, I see some directories in the root directory. However, when I do this with lftp I get this:
[r...@abcd ~]# lftp lftp :~> set net:max-retries 1 lftp :~> set sftp:connect-program ssh -i /home/send/sshprivatekey lftp :~> open -u username, sftp://x.x.x.x lftp usern...@x.x.x.x:~> ls drwxrwxrwx 0 2002-06-24 08:50 . drwxrwxrwx 0 2002-06-24 08:50 .. drwxrwxrwx 0 2009-11-10 03:21 HomeDirA drwxrwxrwx 0 2008-09-09 13:32 HomeDirB lftp usern...@x.x.x.x:~> cd / cd ok, cwd=/ lftp usern...@x.x.x.x:/> ls drwxrwxrwx 0 2002-06-24 08:50 . drwxrwxrwx 0 2002-06-24 08:50 .. drwxrwxrwx 0 2009-11-10 03:21 HomeDirA drwxrwxrwx 0 2008-09-09 13:32 HomeDirBAs far as I can tell, the cd / worked ok, but when I ls, I get a list of the contents of my home directory again?! I can't see anything obvious that i'm doing wrong.
Unfortunately I have no idea what ssh/sftp server runs at the other end and I don't think it would be easy to find out (unless there's some magic I can perform with sftp?).
If it's helpful, this is lftp 3.7.11, on RHEL 5.4. Thanks Gary