我现在正在上班,同事给我准备了一个 Debian 服务器就走了。
现在我刚刚发现我可以使用 Windows(XP)机器上的 PuTTY 通过 ssh 连接到它(遗憾的是这里没有 Linux 机器),但是当我在 Mac 上时,它不知何故ssh [user@ip]
不接受我的密码。
与 SFTP 相同:WinSCP 运行良好,命令行 SCP 或任何 SFTP 软件(如 CyberDuck)根本不起作用。(“错误的用户名或密码”)
我唯一知道的线索是,只要我将 OSX 上的 FileZilla 设置为使用不存在的编码,它就能够连接。它会抱怨编码无效,然后连接正常。将编码设置为 UTF-8 或自动检测只会再次出现身份验证错误。
ServerFault,您知道我该如何让这台 Mac 正确连接到机器吗?非常感谢。
编辑:这是 ssh -v 的输出:
Angua:~ winsmith$ ssh -v web96_rootmaster@IPADDRESS
OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to IPADDRESS [IPADDRESS] port 22.
debug1: Connection established.
debug1: identity file /Users/winsmith/.ssh/identity type -1
debug1: identity file /Users/winsmith/.ssh/id_rsa type -1
debug1: identity file /Users/winsmith/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
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 'IPADDRESS' is known and matches the RSA host key.
debug1: Found key in /Users/winsmith/.ssh/known_hosts:22
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/winsmith/.ssh/identity
debug1: Trying private key: /Users/winsmith/.ssh/id_rsa
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: /Users/winsmith/.ssh/id_dsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
Password:
debug1: Authentications that can continue: publickey,keyboard-interactive
Password:
说实话,我从中找不到任何线索。其他人能找到吗?
答案1
所以如果你更改编码,你就能从 Mac 连接吗?你的密码是否包含一些奇怪的字符,比如带重音符号的字符?
如果您在 Mac 上的文本编辑器中输入密码,它会像您预期的那样显示吗?
答案2
尝试读取服务器上的日志,以便您可以了解拒绝连接尝试的原因。基于 debian 的系统上为 /var/log/auth.long,基于 redhat 的系统上为 /var/log/security。
答案3
您确定服务器本身运行的是 UTF-8 吗?因为您一直试图设置 UTF-8?
尝试:
set | grep LANG
然后强制 filezilla/SSH 使用它。也许是 xx_XX.ISO-8859-1?
我相信 Windows 将使用该编码作为默认编码。
编辑:我不小心把 mozilla 写成了 filezilla
答案4
尝试 ssh -v -v -v user@ip 也许更多的调试输出会有所帮助:)