I just tried that and get the same response.

I also can't cd into any of the directories, see further example, I cd to /, rels, it shows the directories in my home dir, I can cd into those directories. However, so show with sftp, when I do the same thing I see RootDirA/B and I can cd into RootDirA/B. It's like lftp although thinks i've switched to /, hasn't actually managed to do that.

lftp [email protected]:~> cd /
cd ok, cwd=/
lftp [email protected]:/> rels
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 [email protected]:/> pwd
sftp://username:@x.x.x.x/
lftp [email protected]:/> cd RootDirA
cd: Access failed: The system cannot find the file specified.  (/RootDirA)
lftp [email protected]:/> cd HomeDirA
lftp [email protected]:/HomeDirA> pwd
sftp://username:@x.x.x.x/HomeDirA

Any further ideas?

Gary


Jonathan Kaufman wrote:
Have you tried using rels to see if it's checking the ls cache instead of
actually sending an ls?

lftp :~> help ls
Usage: ls [<args>]
List remote files. You can redirect output of this command to file
or via pipe to external command.
By default, ls output is cached, to see new listing use `rels' or
`cache flush'.
See also `help cls'.
lftp :~> help rels
Usage: rels [<args>]
Same as `ls', but don't look in cache

Granted, I would have expected lftp to notice that you changed directories
and not look in the ls cache when you do an ls again.


Jonathan



|------------>
| From:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Gary Richards <[email protected]>                                       
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |[email protected]                                                            
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |11/12/2009 02:20 AM                                                          
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |sftp cd to root directory not working                                        
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Sent by:   |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |[email protected]                                                      
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|





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"
[email protected]
Connecting to x.x.x.x...
sftp> ls
HomeDirA  HomeDirB
sftp> cd /
sftp> ls
RootDirA RootDirB

The 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 [email protected]:~> 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 [email protected]:~> cd /
cd ok, cwd=/
lftp [email protected]:/> 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

As 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




Reply via email to