lftp不列出文件但允许下载

时间:2017-11-06 19:18:29

标签: sftp lftp

我正在编写一个脚本,使用lftp(在旧的FreeBSD服务器上运行版本3.7.3)将文件移入和移出sftp服务器。

问题是lftp没有通过执行ls和cls列出现有的文件。它只列出目录。 我已经尝试了mget *来获取所有文件,但也失败了。 相反,如果指定了文件名,cat和mget将完美地工作。 清除然后关闭lftp缓存并没有什么不同。

我已阅读this链接但不是我的情况。如果我做" ls temp.txt"虽然文件存在,但我没有得到任何内容而不是链接中的错误。

我可以使用WinSCP和AnyFTP(一个Android应用程序)列出文件,所以我猜它与权限没有任何关系。

有什么想法吗?

我设法通过在〜/ .lftp /中添加一个名为rc的文件来实现这一点,该文件包含单词debug:

lftp myUserName@remoteHostIP:~> ls
---- Running connect program (ssh -a -x -s -l myUserName remoteHostIP sftp)
---> sending a packet, length=5, type=1(INIT), id=0
<--- myUserName@remoteHostIP's password: XXXX
<--- got a packet, length=5, type=2(VERSION), id=0
---- protocol version set to 3
---> sending a packet, length=10, type=16(REALPATH), id=1
<--- got a packet, length=47, type=104(NAME), id=1
---- home set to /myUserName/
---- path on wire is `/myUserName/'
---> sending a packet, length=22, type=11(OPENDIR), id=2
<--- got a packet, length=22, type=102(HANDLE), id=2
---- got file handle 4F70656E44697248616E646C65 (13)
---> sending a packet, length=22, type=12(READDIR), id=3
<--- got a packet, length=1238, type=104(NAME), id=3
---- file name count=11
---> sending a packet, length=22, type=12(READDIR), id=4
---> sending a packet, length=22, type=12(READDIR), id=5
<--- got a packet, length=28, type=101(STATUS), id=4
---- status code=1(EOF), message=End of file
---- eof
drw-rw-rw   1     root     root         0 Nov  6 20:03 test
drw-rw-rw   1     root     root         0 Nov  6 12:52 test1
---> sending a packet, length=22, type=4(CLOSE), id=6
<--- got a packet, length=28, type=101(STATUS), id=5
---- status code=1(EOF), message=End of file
<--- got a packet, length=24, type=101(STATUS), id=6
---- status code=0(OK), message=Success
lftp myUserName@remoteHostIP:~>

我还设法使用java列出文件。

这是WinSCP日志文件:

. 2017-11-07 18:08:30.735 --------------------------------------------------------------------------
. 2017-11-07 18:08:30.735 WinSCP Version 5.5.6 (Build 4746) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2017-11-07 18:08:30.735 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2017-11-07 18:08:30.735 Local account: mydomain\myWinUserName
. 2017-11-07 18:08:30.735 Working directory: C:\Program Files (x86)\WinSCP
. 2017-11-07 18:08:30.735 Process ID: 3116
. 2017-11-07 18:08:30.735 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" 
. 2017-11-07 18:08:30.736 Time zone: Current: GMT+2, Standard: GMT+2 (GTB Standard Time), DST: GMT+3 (GTB Daylight Time), DST Start: 26/3/2017, DST End: 29/10/2017
. 2017-11-07 18:08:30.736 Login time: Τρίτη, 7 Νοέμβριος 2017 6:08:30 μμ
. 2017-11-07 18:08:30.736 --------------------------------------------------------------------------
. 2017-11-07 18:08:30.736 Session name: myUserName@remoteHostIP (Site)
. 2017-11-07 18:08:30.736 Host name: remoteHostIP (Port: 22)
. 2017-11-07 18:08:30.736 User name: myUserName (Password: Yes, Key file: No)
. 2017-11-07 18:08:30.736 Tunnel: No
. 2017-11-07 18:08:30.736 Transfer Protocol: SFTP
. 2017-11-07 18:08:30.736 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2017-11-07 18:08:30.736 Proxy: none
. 2017-11-07 18:08:30.736 Send buffer: 262144
. 2017-11-07 18:08:30.736 SSH protocol version: 2; Compression: No
. 2017-11-07 18:08:30.736 Bypass authentication: No
. 2017-11-07 18:08:30.736 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2017-11-07 18:08:30.736 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2017-11-07 18:08:30.736 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2017-11-07 18:08:30.736 Simple channel: Yes
. 2017-11-07 18:08:30.736 Return code variable: Autodetect; Lookup user groups: A
. 2017-11-07 18:08:30.736 Shell: default
. 2017-11-07 18:08:30.736 EOL: 0, UTF: 2
. 2017-11-07 18:08:30.736 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2017-11-07 18:08:30.736 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2017-11-07 18:08:30.736 Local directory: C:\Users\myComputerName.mydomain\Documents, Remote directory: /myUserName, Update: Yes, Cache: No
. 2017-11-07 18:08:30.736 Cache directory changes: No, Permanent: Yes
. 2017-11-07 18:08:30.736 DST mode: 1; Timezone offset: 0h 0m
. 2017-11-07 18:08:30.736 --------------------------------------------------------------------------
. 2017-11-07 18:08:30.846 Looking up host "remoteHostIP"
. 2017-11-07 18:08:30.846 Connecting to remoteHostIP port 22
. 2017-11-07 18:08:30.899 Server version: SSH-2.0-CoreFTP-0.3.3
. 2017-11-07 18:08:30.899 Using SSH protocol version 2
. 2017-11-07 18:08:30.899 We claim version: SSH-2.0-WinSCP_release_5.5.6
. 2017-11-07 18:08:30.911 Doing Diffie-Hellman group exchange
. 2017-11-07 18:08:31.159 Doing Diffie-Hellman key exchange with hash SHA-256
. 2017-11-07 18:08:32.181 Verifying host key rsa2 0x10001,0xcc1f532a43799760 7ff06787b19253a9 14e9acf3b711f594 1bd693efd365e88c 51281a973ecfd0c2 cfd758a92844a16e 704a0caa9fada7a0 235a4f2f00155466 a4fa7c6eabb16adc 89db04638e6904cf 8b50592da6072836 23c0517af0ccd732 d6d59d5f7665ab55 c20c428e702b94c9 18e9289271cdfe98 7972a59dd9ea48b9 79ccf8b13bbcc567 cac1952274a9d4db 689de1d09862f3a1 e88fb7576bd280c9 f50e4d6e72ec0e99 2fea70d254c87be5 b5505b5aa8ae90a9 71552671a65e32b7 a91d27b7eeac5922 6eb057c5a02bd8c7 4e54d87de9c13b55 d49291a3b8424e15 5eb8d90d4908f48e ba2ad7cf99af5d61 0b9530a426e70098 ac7454b39f66f07f  with fingerprint ssh-rsa 2048 76:a0:49:c8:6f:54:9a:8b:82:3b:19:d0:2a:c3:c7:e3
. 2017-11-07 18:08:32.206 Host key matches cached key
. 2017-11-07 18:08:32.206 Host key fingerprint is:
. 2017-11-07 18:08:32.206 ssh-rsa 2048 76:a0:49:c8:6f:54:9a:8b:82:3b:19:d0:2a:c3:c7:e3
. 2017-11-07 18:08:32.206 Initialised AES-256 SDCTR client->server encryption
. 2017-11-07 18:08:32.206 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2017-11-07 18:08:32.214 Initialised AES-256 SDCTR server->client encryption
. 2017-11-07 18:08:32.214 Initialised HMAC-SHA-256 server->client MAC algorithm
! 2017-11-07 18:08:32.222 Using username "myUserName".
. 2017-11-07 18:08:32.269 Prompt (7, SSH password, , &Password: )
. 2017-11-07 18:08:32.269 Using stored password.
. 2017-11-07 18:08:32.316 Sent password
. 2017-11-07 18:08:32.327 Access granted
. 2017-11-07 18:08:32.327 Opening session as main channel
. 2017-11-07 18:08:32.336 Opened main channel
. 2017-11-07 18:08:32.557 Started a shell/command
. 2017-11-07 18:08:32.569 --------------------------------------------------------------------------
. 2017-11-07 18:08:32.569 Using SFTP protocol.
. 2017-11-07 18:08:32.569 Doing startup conversation with host.
> 2017-11-07 18:08:32.621 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2017-11-07 18:08:32.834 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2017-11-07 18:08:32.834 SFTP version 3 negotiated.
. 2017-11-07 18:08:32.834 We believe the server has signed timestamps bug
. 2017-11-07 18:08:32.834 We will use UTF-8 strings when appropriate
. 2017-11-07 18:08:32.873 Changing directory to "/myUserName".
. 2017-11-07 18:08:32.873 Getting real path for '/myUserName'
> 2017-11-07 18:08:32.873 Type: SSH_FXP_REALPATH, Size: 21, Number: 16
< 2017-11-07 18:08:32.882 Type: SSH_FXP_NAME, Size: 47, Number: 16
. 2017-11-07 18:08:32.882 Real path is '/myUserName'
. 2017-11-07 18:08:32.882 Trying to open directory "/myUserName".
> 2017-11-07 18:08:32.882 Type: SSH_FXP_LSTAT, Size: 21, Number: 263
< 2017-11-07 18:08:32.892 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2017-11-07 18:08:32.892 Getting current directory name.
. 2017-11-07 18:08:33.023 Listing directory "/myUserName".
> 2017-11-07 18:08:33.023 Type: SSH_FXP_OPENDIR, Size: 21, Number: 523
< 2017-11-07 18:08:33.032 Type: SSH_FXP_HANDLE, Size: 22, Number: 523
> 2017-11-07 18:08:33.032 Type: SSH_FXP_READDIR, Size: 22, Number: 780
< 2017-11-07 18:08:33.053 Type: SSH_FXP_NAME, Size: 1238, Number: 780
> 2017-11-07 18:08:33.053 Type: SSH_FXP_READDIR, Size: 22, Number: 1036
< 2017-11-07 18:08:33.073 Type: SSH_FXP_STATUS, Size: 28, Number: 1036
< 2017-11-07 18:08:33.073 Status code: 1
> 2017-11-07 18:08:33.073 Type: SSH_FXP_CLOSE, Size: 22, Number: 1284
. 2017-11-07 18:08:33.073 temp.txt;-;4;2017-11-06T10:58:10.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.073 temp2222.txt;-;5;2017-11-06T18:09:34.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.073 test;D;0;2017-11-06T18:03:00.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.074 test1;D;0;2017-11-06T10:52:43.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.074 test2.txt;-;8;2017-11-06T18:02:41.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.074 test3.txt;-;8;2017-11-06T18:02:41.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.074 test4.txt;-;8;2017-11-06T18:02:41.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.074 test5.txt;-;8;2017-11-06T18:02:41.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.074 test6.txt;-;8;2017-11-06T18:02:41.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.074 test7.txt;-;8;2017-11-06T18:02:41.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.074 test8.txt;-;8;2017-11-06T18:02:41.000Z;"" [0];"" [0];rw-rw-rw-;1
. 2017-11-07 18:08:33.173 Startup conversation with host finished.
. 2017-11-07 18:08:34.064 Not refreshing directory, caching is off.

0 个答案:

没有答案