archlinux 上的无密码 ssh(ssh-copy-id 后仍提示输入密码)

archlinux 上的无密码 ssh(ssh-copy-id 后仍提示输入密码)

在 ubuntu/mint 上,无密码 ssh 登录所需要做的就是:

ssh-keygen -t rsa # on both pc
ssh-copy-id targetpc
ssh targetpc # does not prompt from password anymore

就这样..

我在 archlinux (或 manjaro)上做了同样的事情,它在第三步不起作用,它仍然提示输入密码。

debug1: Reading configuration data /home/blablabla/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 192.168.11.3 [192.168.11.3] port 22.
debug1: Connection established.
debug1: identity file /home/blablabla/.ssh/id_rsa type 1
debug1: identity file /home/blablabla/.ssh/id_rsa-cert type -1
debug1: identity file /home/blablabla/.ssh/id_dsa type 2
debug1: identity file /home/blablabla/.ssh/id_dsa-cert type -1
debug1: identity file /home/blablabla/.ssh/id_ecdsa type 3
debug1: identity file /home/blablabla/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.1
debug1: match: OpenSSH_6.1 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client arcfour hmac-md5 [email protected]
debug1: kex: client->server arcfour hmac-md5 [email protected]
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 71:d2:05:dd:21:d1:ae:fc:a8:e5:f2:1c:2c:60:31:85
debug1: Host '192.168.11.3' is known and matches the ECDSA host key.
debug1: Found key in /home/blablabla/.ssh/known_hosts:11
debug1: ssh_ecdsa_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
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/blablabla/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Offering DSA public key: /home/blablabla/.ssh/id_dsa
debug1: Authentications that can continue: publickey,password
debug1: Offering ECDSA public key: /home/blablabla/.ssh/id_ecdsa
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password

当使用旧的主目录(来自 ubuntu)时,ssh-copy-id 显示一些我以前从未见过的信息

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

是否缺少一些我应该在 archlinux 上执行的步骤?

编辑:两台机器上的 openssh 版本不同,一台是 6.1p1-6,其他是 6.2p1-1

答案1

通常这意味着您的主目录或 .ssh/ 目录没有正确的权限。检查远程端的系统日志中是否有来自 sshd 的错误。

例如,包含以下内容的行:

sshd[pid]: Authentication refused: bad ownership or modes for directory /home/yourusername

/var/log/auth.log

意味着你必须做

chmod 700 ~

相关内容