ssh - Linux 上的 FileZilla, 'sftp' 命令无法连接到特定服务器。 SSH 工作,在 Windows 上一切正常

标签 ssh sftp filezilla

我有一个特定的服务器(我们称它为 some.server.com),我不是它的管理员,但我有一个用户启用 SSH 的帐户(它在 Windows 上使用 PuTTY,在 Linux 上使用默认的 ssh 命令),我想使用 SFTP 协议(protocol)访问它。

在 Windows 上,使用 FileZilla 一切正常。我配置了 user@some.server.com 并在询问时输入密码。但是,我确实必须将“高级 -> 默认远程目录”更改为 /(或我的主目录的完整路径)才能正常工作。如果我不这样做,它会在行后退出:

Command:   pwd
Response:  Current directory is: "."
Error:     Failed to parse returned path.
Error:     Failed to retrieve directory listing.

我认为这是由于服务器中的一些奇怪的错误配置造成的。

然而,在 Linux (Linux Mint 17.2) 上,没有任何效果。 FileZilla 在 open "user@some.server.com"22 挂起,然后超时。如果我打开调试输出,会发生以下情况:

Command:    open "user@some.server.com" 22
Trace:  Server version: SSH-2.0-OpenSSH_6.9p1-hpn14v5
Trace:  Using SSH protocol version 2
Trace:  We claim version: SSH-2.0-PuTTY_Local:_Sep_14_2013_01:12:43
Trace:  Doing Diffie-Hellman group exchange
** About 30 seconds go by **
Error:  Connection timed out
Trace:  CControlSocket::DoClose(2050)
Trace:  CSftpControlSocket::ResetOperation(2114)
Trace:  CControlSocket::ResetOperation(2114)
Error:  Could not connect to server

我认为这可能是 FileZilla 安装的问题,但它适用于我尝试过的所有其他服务器(包括我的个人服务器)。我仔细检查了一下,Windows 在连接到同一台服务器时进行了 ECDH key 交换,而不是像此跟踪中那样进行 DH。也许这就是问题所在?

我还尝试使用 sftp 命令。它连接并询问我的密码。我输入它,然后它退出并出现此错误:

sftp user@some.server.com
Password: ** I enter my password **
Connected to some.server.com.
Couldn't canonicalize: No such file or directory
Need cwd

我认为这与 FileZilla 在 Windows 上遇到的错误相同,所以我尝试了命令 sftp user@some.server.com:/,但我遇到了同样的错误。

我已经通过电子邮件与管理员交谈过,我是第一个报告此类问题的人。他们认为可能是我配置有问题,要我亲自到他们办公室帮忙解决问题。问题是,这是一台台式机,我目前没有安装了 Linux 的笔记本电脑可以对其进行测试。我实际上想在我的 Windows 笔记本电脑上安装 VirtualBox 来仔细检查,但我一直没时间。

有什么想法吗?谢谢。

编辑 1:WinSCP 日志

. 2015-11-16 19:40:25.018 Session name: user@some.server.com (Ad-Hoc site)
. 2015-11-16 19:40:25.018 Host name: some.server.com (Port: 22)
. 2015-11-16 19:40:25.019 User name: user (Password: Yes, Key file: No)
. 2015-11-16 19:40:25.019 Tunnel: No
. 2015-11-16 19:40:25.019 Transfer Protocol: SFTP (SCP)
. 2015-11-16 19:40:25.019 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2015-11-16 19:40:25.019 Disable Nagle: No
. 2015-11-16 19:40:25.019 Proxy: none
. 2015-11-16 19:40:25.019 Send buffer: 262144
. 2015-11-16 19:40:25.019 SSH protocol version: 2; Compression: No
. 2015-11-16 19:40:25.019 Bypass authentication: No
. 2015-11-16 19:40:25.019 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2015-11-16 19:40:25.019 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2015-11-16 19:40:25.019 KEX: dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN
. 2015-11-16 19:40:25.019 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A,A
. 2015-11-16 19:40:25.019 Simple channel: Yes
. 2015-11-16 19:40:25.019 Return code variable: Autodetect; Lookup user groups: A
. 2015-11-16 19:40:25.019 Shell: default
. 2015-11-16 19:40:25.019 EOL: 0, UTF: 2
. 2015-11-16 19:40:25.019 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2015-11-16 19:40:25.019 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2015-11-16 19:40:25.019 SFTP Bugs: A,A
. 2015-11-16 19:40:25.019 SFTP Server: default
. 2015-11-16 19:40:25.019 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2015-11-16 19:40:25.019 Cache directory changes: Yes, Permanent: Yes
. 2015-11-16 19:40:25.019 DST mode: 1
. 2015-11-16 19:40:25.019 --------------------------------------------------------------------------
. 2015-11-16 19:40:25.095 Looking up host "some.server.com"
. 2015-11-16 19:40:25.099 Connecting to X.X.X.X port 22
. 2015-11-16 19:40:27.305 Selecting events 63 for socket 1172
. 2015-11-16 19:40:27.307 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:27.307 Looking for incoming data
. 2015-11-16 19:40:27.307 Looking for network events
. 2015-11-16 19:40:27.307 Detected network event
. 2015-11-16 19:40:27.307 Enumerating network events for socket 1172
. 2015-11-16 19:40:27.307 Enumerated 18 network events making 18 cumulative events for socket 1172
. 2015-11-16 19:40:27.307 Handling network write event on socket 1172 with error 0
. 2015-11-16 19:40:27.307 Handling network connect event on socket 1172 with error 0
. 2015-11-16 19:40:27.307 Looking for network events
. 2015-11-16 19:40:27.331 Detected network event
. 2015-11-16 19:40:27.331 Enumerating network events for socket 1172
. 2015-11-16 19:40:27.331 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:27.331 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:27.331 Server version: SSH-2.0-OpenSSH_6.9p1-hpn14v5
. 2015-11-16 19:40:27.331 Using SSH protocol version 2
. 2015-11-16 19:40:27.331 We claim version: SSH-2.0-WinSCP_release_5.7.6
. 2015-11-16 19:40:27.331 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:27.332 Looking for incoming data
. 2015-11-16 19:40:27.332 Looking for network events
. 2015-11-16 19:40:27.348 Detected network event
. 2015-11-16 19:40:27.348 Enumerating network events for socket 1172
. 2015-11-16 19:40:27.348 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:27.348 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:27.348 Using Diffie-Hellman with standard group "group14"
. 2015-11-16 19:40:27.348 Doing Diffie-Hellman key exchange with hash SHA-1
. 2015-11-16 19:40:27.395 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:27.395 Looking for incoming data
. 2015-11-16 19:40:27.395 Looking for network events
. 2015-11-16 19:40:27.424 Detected network event
. 2015-11-16 19:40:27.425 Enumerating network events for socket 1172
. 2015-11-16 19:40:27.425 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:27.425 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:27.491 Verifying host key rsa2 0x10001,0xa3b26aa134c3f969 4052dfe9a1ec42d7 310b92bcac0703ad c318ecf305d516a4 8b56cbd1d737d058 2c8de0d374ae84ed e59afe086462b068 47935368373deeca 5db04cceefbfb6e8 0b4176041e1ffc74 a729a23421d6ad97 45e9101fab34399f 103e3f3567612029 d672a215feda64fd 93de6a5cfb59d69e 0e383e6e0e332f58 a835944076e5b952 947521b8d6b7cc92 9c9758b73211928b a6eade34dfc79617 b8ae9a4743abfad0 12fd52a5fc36aaaf 705058885fe8a557 48d691f6c5bdf6fc 1c9d494f4505f4d6 d9dc01802dec6cf7 79193e2b7c7c948c 8ce04556750adf05 06a401f5f05cefcd 4c492a48c97144ee 8a724204641faba0 b4dd9e1d9f0760cd  with fingerprint ssh-rsa 2048 40:71:a0:95:ed:0a:ac:5c:26:8c:ed:c9:7b:ac:a1:47
. 2015-11-16 19:40:27.509 Host key matches cached key
. 2015-11-16 19:40:27.509 Selecting events 63 for socket 1172
. 2015-11-16 19:40:27.509 Host key fingerprint is:
. 2015-11-16 19:40:27.509 ssh-rsa 2048 40:71:a0:95:ed:0a:ac:5c:26:8c:ed:c9:7b:ac:a1:47
. 2015-11-16 19:40:27.509 Initialised AES-256 SDCTR client->server encryption
. 2015-11-16 19:40:27.509 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2015-11-16 19:40:27.509 Initialised AES-256 SDCTR server->client encryption
. 2015-11-16 19:40:27.509 Initialised HMAC-SHA-256 server->client MAC algorithm
. 2015-11-16 19:40:27.509 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:27.509 Looking for incoming data
. 2015-11-16 19:40:27.509 Looking for network events
. 2015-11-16 19:40:27.605 Detected network event
. 2015-11-16 19:40:27.605 Enumerating network events for socket 1172
. 2015-11-16 19:40:27.605 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:27.605 Handling network read event on socket 1172 with error 0
! 2015-11-16 19:40:27.605 Using username "user".
. 2015-11-16 19:40:27.613 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:27.613 Looking for incoming data
. 2015-11-16 19:40:27.613 Looking for network events
. 2015-11-16 19:40:27.641 Detected network event
. 2015-11-16 19:40:27.641 Enumerating network events for socket 1172
. 2015-11-16 19:40:27.641 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:27.641 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:27.641 Attempting keyboard-interactive authentication
. 2015-11-16 19:40:27.641 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:27.641 Looking for incoming data
. 2015-11-16 19:40:27.641 Looking for network events
. 2015-11-16 19:40:27.931 Detected network event
. 2015-11-16 19:40:27.931 Enumerating network events for socket 1172
. 2015-11-16 19:40:27.931 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:27.931 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:27.931 Prompt (keyboard interactive, "SSH server authentication", "Using keyboard-interactive authentication.", "Password: ")
. 2015-11-16 19:40:27.931 Using stored password.
. 2015-11-16 19:40:27.974 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:27.974 Looking for incoming data
. 2015-11-16 19:40:27.974 Looking for network events
. 2015-11-16 19:40:28.563 Detected network event
. 2015-11-16 19:40:28.563 Enumerating network events for socket 1172
. 2015-11-16 19:40:28.563 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:28.563 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:28.563 Prompt (keyboard interactive, "SSH server authentication", <no instructions>, <no prompt>)
. 2015-11-16 19:40:28.564 Ignoring empty SSH server authentication request
. 2015-11-16 19:40:28.564 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:28.564 Looking for incoming data
. 2015-11-16 19:40:28.564 Looking for network events
. 2015-11-16 19:40:28.594 Detected network event
. 2015-11-16 19:40:28.594 Enumerating network events for socket 1172
. 2015-11-16 19:40:28.594 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:28.594 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:28.594 Access granted
. 2015-11-16 19:40:28.594 Opening session as main channel
. 2015-11-16 19:40:28.594 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:28.594 Looking for incoming data
. 2015-11-16 19:40:28.594 Looking for network events
. 2015-11-16 19:40:28.715 Detected network event
. 2015-11-16 19:40:28.715 Enumerating network events for socket 1172
. 2015-11-16 19:40:28.715 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:28.715 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:28.716 Server initiated key re-exchange
. 2015-11-16 19:40:28.716 Using Diffie-Hellman with standard group "group14"
. 2015-11-16 19:40:28.716 Doing Diffie-Hellman key exchange with hash SHA-1
. 2015-11-16 19:40:28.803 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:28.803 Looking for incoming data
. 2015-11-16 19:40:28.803 Looking for network events
. 2015-11-16 19:40:28.842 Detected network event
. 2015-11-16 19:40:28.842 Enumerating network events for socket 1172
. 2015-11-16 19:40:28.842 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:28.842 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:28.907 Initialised AES-256 SDCTR client->server encryption
. 2015-11-16 19:40:28.907 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2015-11-16 19:40:28.907 Initialised AES-256 SDCTR server->client encryption
. 2015-11-16 19:40:28.907 Initialised HMAC-SHA-256 server->client MAC algorithm
. 2015-11-16 19:40:28.907 Opened main channel
. 2015-11-16 19:40:28.907 Waiting for the server to continue with the initialization
. 2015-11-16 19:40:28.907 Looking for incoming data
. 2015-11-16 19:40:28.907 Looking for network events
. 2015-11-16 19:40:28.979 Detected network event
. 2015-11-16 19:40:28.979 Enumerating network events for socket 1172
. 2015-11-16 19:40:28.979 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:28.979 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:28.979 Started a shell/command
. 2015-11-16 19:40:28.983 --------------------------------------------------------------------------
. 2015-11-16 19:40:28.983 Using SFTP protocol.
. 2015-11-16 19:40:28.984 Doing startup conversation with host.
. 2015-11-16 19:40:28.984 Session upkeep
. 2015-11-16 19:40:28.984 Looking for network events
. 2015-11-16 19:40:28.984 Timeout waiting for network events
> 2015-11-16 19:40:29.034 Type: SSH_FXP_INIT, Size: 5, Number: -1
> 2015-11-16 19:40:29.034 01,00,00,00,06,
. 2015-11-16 19:40:29.034 Sent 9 bytes
. 2015-11-16 19:40:29.034 There are 0 bytes remaining in the send buffer
. 2015-11-16 19:40:29.034 Looking for network events
. 2015-11-16 19:40:29.034 Timeout waiting for network events
. 2015-11-16 19:40:29.034 Waiting for another 4 bytes
. 2015-11-16 19:40:29.034 Looking for incoming data
. 2015-11-16 19:40:29.034 Looking for network events
. 2015-11-16 19:40:29.050 Detected network event
. 2015-11-16 19:40:29.050 Enumerating network events for socket 1172
. 2015-11-16 19:40:29.050 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:29.050 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:29.050 Received 154 bytes (0)
. 2015-11-16 19:40:29.050 Read 4 bytes (150 pending)
. 2015-11-16 19:40:29.050 Read 150 bytes (0 pending)
< 2015-11-16 19:40:29.050 Type: SSH_FXP_VERSION, Size: 150, Number: -1
< 2015-11-16 19:40:29.050 02,00,00,00,03,00,00,00,18,70,6F,73,69,78,2D,72,65,6E,61,6D,65,40,6F,70,65,
< 2015-11-16 19:40:29.050 6E,73,73,68,2E,63,6F,6D,00,00,00,01,31,00,00,00,13,73,74,61,74,76,66,73,40,
< 2015-11-16 19:40:29.050 6F,70,65,6E,73,73,68,2E,63,6F,6D,00,00,00,01,32,00,00,00,14,66,73,74,61,74,
< 2015-11-16 19:40:29.050 76,66,73,40,6F,70,65,6E,73,73,68,2E,63,6F,6D,00,00,00,01,32,00,00,00,14,68,
< 2015-11-16 19:40:29.050 61,72,64,6C,69,6E,6B,40,6F,70,65,6E,73,73,68,2E,63,6F,6D,00,00,00,01,31,00,
< 2015-11-16 19:40:29.050 00,00,11,66,73,79,6E,63,40,6F,70,65,6E,73,73,68,2E,63,6F,6D,00,00,00,01,31,
. 2015-11-16 19:40:29.050 SFTP version 3 negotiated.
. 2015-11-16 19:40:29.050 Unknown server extension posix-rename@openssh.com="1"
. 2015-11-16 19:40:29.050 Supports statvfs@openssh.com extension version "2"
. 2015-11-16 19:40:29.050 Unknown server extension fstatvfs@openssh.com="2"
. 2015-11-16 19:40:29.050 Supports hardlink@openssh.com extension version "1"
. 2015-11-16 19:40:29.050 Unknown server extension fsync@openssh.com="1"
. 2015-11-16 19:40:29.050 We believe the server has signed timestamps bug
. 2015-11-16 19:40:29.050 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 string are not mandatory
. 2015-11-16 19:40:29.050 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2015-11-16 19:40:29.050 Getting current directory name.
. 2015-11-16 19:40:29.050 Getting real path for '.'
> 2015-11-16 19:40:29.050 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
> 2015-11-16 19:40:29.050 10,00,00,00,10,00,00,00,01,2E,
. 2015-11-16 19:40:29.050 Sent 14 bytes
. 2015-11-16 19:40:29.050 There are 0 bytes remaining in the send buffer
. 2015-11-16 19:40:29.050 Looking for network events
. 2015-11-16 19:40:29.050 Timeout waiting for network events
. 2015-11-16 19:40:29.050 Waiting for another 4 bytes
. 2015-11-16 19:40:29.050 Looking for incoming data
. 2015-11-16 19:40:29.050 Looking for network events
. 2015-11-16 19:40:29.066 Detected network event
. 2015-11-16 19:40:29.066 Enumerating network events for socket 1172
. 2015-11-16 19:40:29.066 Enumerated 1 network events making 1 cumulative events for socket 1172
. 2015-11-16 19:40:29.066 Handling network read event on socket 1172 with error 0
. 2015-11-16 19:40:29.066 Received 33 bytes (0)
. 2015-11-16 19:40:29.066 Read 4 bytes (29 pending)
. 2015-11-16 19:40:29.066 Read 29 bytes (0 pending)
< 2015-11-16 19:40:29.066 Type: SSH_FXP_STATUS, Size: 29, Number: 16
< 2015-11-16 19:40:29.066 65,00,00,00,10,00,00,00,02,00,00,00,0C,4E,6F,20,73,75,63,68,20,66,69,6C,65,
< 2015-11-16 19:40:29.066 00,00,00,00,
< 2015-11-16 19:40:29.066 Status code: 2, Message: 16, Server: No such file, Language:  
* 2015-11-16 19:40:29.066 (ECommand) Error getting name of current remote directory.
* 2015-11-16 19:40:29.066 Cannot get real path for '.'.
* 2015-11-16 19:40:29.066 No such file or directory.
* 2015-11-16 19:40:29.066 Error code: 2
* 2015-11-16 19:40:29.066 Error message from server: No such file

最佳答案

您的帖子中有两个不同的问题。


Failed to parse returned path.

Couldn't canonicalize: No such file or directory

这些是 FileZilla 和 OpenSSH 错误,由您的服务器返回一些奇怪的内容给客户端解析 . 路径(主目录)的请求。

您不能让 OpenSSH sftp 在启动时不尝试解析 .。无论您使用什么语法,它都会无条件地执行此操作。

您可以尝试连接 WinSCP 吗?与 logging设置为 Debug 2 级别?它将在日志中包含更多详细信息,以便我们可以判断是什么破坏了客户端。


Trace: Doing Diffie-Hellman group exchange
** About 30 seconds go by **

不确定为什么 FileZilla 在 DH 组交换上超时。

但是正如您所知 ECDH 有效,请确保您使用支持 ECDH 的 FileZilla 版本。您的版本 (SSH-2.0-PuTTY_Local:_Sep_14_2013_01:12:43) 没有。

关于ssh - Linux 上的 FileZilla, 'sftp' 命令无法连接到特定服务器。 SSH 工作,在 Windows 上一切正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33725428/

相关文章:

python - 使用 pysftp,如何为连接指定超时值?

java - Apache Mina SSHD 1.0 服务器立即退出

Perl's Net::(SSH vs SSH2 vs OpenSSH)——我应该如何比较它们?

linux - 如何在 ash shell 中保持程序在后台运行

bash - 使用bash命令从远程服务器读取大文件的前n行

java - 与 apache commons-vfs2 的连接过多

java - 当使用 JSch 通过 Java 执行时,某些 Unix 命令会失败并返回 "... not found"

azure - 是否可以通过 FTP 访问 Azure Blob 存储?

java - FTP 连接超时 421 : parser error

php - 如何使用php更改文件夹的所有者和组名称?