Unix 上的 SFTP 默认采用密钥认证

Unix 上的 SFTP 默认采用密钥认证

对于你们这些 Unix 高手来说,这可能是一个简单的问题,但我搞不懂,所以我试图从命令行通过 sftp 连接到 Windows 服务器,但远程拒绝连接。当我在详细模式下运行它时,我可以看到系统正在尝试使用我的一个公钥(在我的 ssh 配置中设置并用于我 ssh 连接到的另一台服务器)进行身份验证,而我想要的只是它要求我输入密码,以下是跟踪的净化版本:

sftp -v<username>@<remote_ip_address>
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/Admin/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to <remote_ip_address> [<remote_ip_address>] port 22.
debug1: Connection established.
debug1: identity file /Users/Admin/.ssh/id_rsa type 1
debug1: identity file /Users/Admin/.ssh/id_rsa-cert type -1
debug1: identity file /Users/Admin/.ssh/id_dsa type -1
debug1: identity file /Users/Admin/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9
debug1: match: OpenSSH_5.9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '<remote_ip_address>' is known and matches the RSA host key.
debug1: Found key in /Users/Admin/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received

                            ****USAGE WARNING****

<SFTP Banner  Text>


debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/Admin/.ssh/id_rsa
Connection closed by <remote_ip_address>

当我在装有 WinScp 或 Putty 的 Windows 机器上尝试此操作时,一切正常。但我需要在我的生产服务器 (Centos) 上安装此程序,我无法在生产服务器上安装这些程序或其他实用程序。PS:我也能在我的 Mac 上重现此问题,结果相同,但无法解决。任何帮助都将不胜感激。提前致谢!!

答案1

尝试:

sftp -o PubkeyAuthentication=no <user>@<server>

这应该会禁用您在本次会话中使用公钥的意愿。

相关内容