从 Windows 2000 服务器到 Windows 2016 OpenSSH 服务器的 WinSCP 拒绝启动 shell/命令

从 Windows 2000 服务器到 Windows 2016 OpenSSH 服务器的 WinSCP 拒绝启动 shell/命令

我有一台安装了 WinSCP 4.4.0 的 Windows 2000 服务器,还有一台安装了 OpenSSH 服务器的 Windows 2016 服务器。

我可以从 Linux 顺利 ssh 到 Windows 2016 服务器,也可以使用 PuTTY 从 Windows 2000 服务器顺利 ssh 到 Windows 2016 服务器。我还可以运行 WinSCP 并使用 SFTP 连接到 Windows 2016 服务器。但是,当我尝试使用 SCP 协议连接 WinSCP 时,我收到无法启动 shell/命令的错误。

以下是Windows 2000端的完整日志:

. 2019-05-21 15:22:37.406 --------------------------------------------------------------------------
. 2019-05-21 15:22:37.406 WinSCP Version 4.4.0 (Build 1904) (OS 5.0.2195 Service Pack 4)
. 2019-05-21 15:22:37.406 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2019-05-21 15:22:37.406 Local account: Win2000_host\root
. 2019-05-21 15:22:37.406 Login time: Tuesday, May 21, 2019 3:22:37 PM
. 2019-05-21 15:22:37.406 --------------------------------------------------------------------------
. 2019-05-21 15:22:37.406 Session name: mssql conversion (Modified stored session)
. 2019-05-21 15:22:37.406 Host name: <win2016_ip> (Port: 22)
. 2019-05-21 15:22:37.406 User name: my_user (Password: Yes, Key file: Yes)
. 2019-05-21 15:22:37.406 Tunnel: No
. 2019-05-21 15:22:37.406 Transfer Protocol: SCP
. 2019-05-21 15:22:37.406 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2019-05-21 15:22:37.406 Proxy: none
. 2019-05-21 15:22:37.406 SSH protocol version: 2; Compression: No
. 2019-05-21 15:22:37.406 Bypass authentication: No
. 2019-05-21 15:22:37.406 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: 
No
. 2019-05-21 15:22:37.406 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2019-05-21 15:22:37.406 SSH Bugs: A,A,A,A,A,A,A,A,A
. 2019-05-21 15:22:37.406 SFTP Bugs: A,A
. 2019-05-21 15:22:37.406 Return code variable: Autodetect; Lookup user groups: Yes
. 2019-05-21 15:22:37.406 Shell: default
. 2019-05-21 15:22:37.406 EOL: 0, UTF: 2
. 2019-05-21 15:22:37.406 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2019-05-21 15:22:37.406 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2019-05-21 15:22:37.406 Local directory: F:\bk\development, Remote directory: 
/C:/Users/my_user/Downloads, Update: No, Cache: Yes
. 2019-05-21 15:22:37.406 Cache directory changes: Yes, Permanent: Yes
. 2019-05-21 15:22:37.406 DST mode: 1
. 2019-05-21 15:22:37.406 --------------------------------------------------------------------------
. 2019-05-21 15:22:37.406 Looking up host "<win2016_ip>"
. 2019-05-21 15:22:37.406 Connecting to <win2016_ip> port 22
. 2019-05-21 15:22:37.515 Server version: SSH-2.0-OpenSSH_for_Windows_7.9
. 2019-05-21 15:22:37.515 Using SSH protocol version 2
. 2019-05-21 15:22:37.515 We claim version: SSH-2.0-WinSCP_release_4.4
. 2019-05-21 15:22:37.578 Using Diffie-Hellman with standard group "group14"
. 2019-05-21 15:22:37.578 Doing Diffie-Hellman key exchange with hash SHA-1
. 2019-05-21 15:22:37.875 Host key fingerprint is:
. 2019-05-21 15:22:37.875 ssh-rsa 2048 3d:00:8f:80:66:c8:d9:68:46:fe:3f:4d:a2:f7:bc:c2
. 2019-05-21 15:22:37.875 Initialised AES-256 SDCTR client->server encryption
. 2019-05-21 15:22:37.875 Initialised HMAC-SHA1 client->server MAC algorithm
. 2019-05-21 15:22:37.875 Initialised AES-256 SDCTR server->client encryption
. 2019-05-21 15:22:37.875 Initialised HMAC-SHA1 server->client MAC algorithm
. 2019-05-21 15:22:38.000 Reading private key file "C:\Documents and Settings\root\ssh\id_rsa.ppk"
! 2019-05-21 15:22:38.000 Using username "my_user".
. 2019-05-21 15:22:38.046 Offered public key
! 2019-05-21 15:22:38.093 Server refused our key
. 2019-05-21 15:22:38.093 Server refused our key
. 2019-05-21 15:22:38.093 Attempting keyboard-interactive authentication
. 2019-05-21 15:22:38.140 Server refused keyboard-interactive authentication
. 2019-05-21 15:22:38.140 Prompt (7, SSH password, , &Password: )
. 2019-05-21 15:22:38.140 Using stored password.
. 2019-05-21 15:22:38.140 Sent password
. 2019-05-21 15:22:38.187 Access granted
. 2019-05-21 15:22:38.390 Opened channel for session
. 2019-05-21 15:22:38.531 Server refused to start a shell/command
* 2019-05-21 15:22:38.531 (ESshFatal) Server refused to start a shell/command
* 2019-05-21 15:22:38.531 Authentication log (see session log for details):
* 2019-05-21 15:22:38.531 Using username "my_user".
* 2019-05-21 15:22:38.531 Server refused our key.
* 2019-05-21 15:22:38.531 
* 2019-05-21 15:22:38.531 Authentication failed.

我检查了 Windows 2016 服务器上的事件查看器,以查找 OpenSSH 服务。它只显示以下内容:

sshd: Accepted password for my_user from <win2000_ip> port 37288 ssh2

我很困惑,我不确定我 ssh 登录的方式出了什么问题。服务器端没有错误,只有客户端有错误。而且似乎没有办法在 WinSCP 4.4.0 中禁用启动 shell。

如果有任何其他信息可以帮助诊断此问题,请告诉我,谢谢。

答案1

我不知道为什么您会收到这个特定错误(当我尝试使用 WinSCP 对抗 Windows OpenSSH 服务器时,我遇到了这个问题)。

但即使你解决了这个问题,它也不太可能帮助你。WinSCP需要类似 *nix 的 shell。而 Windows OpenSSH 服务器没有自带。所以即使你解决了这个问题,你也会得到另一个错误。

所以问题是,如果 SFTP 有效,为什么还要使用 SCP。

相关内容