带密钥的 ssh 在一个 Ubuntu 机器上有效,但在另一个 Ubuntu 机器上无效

带密钥的 ssh 在一个 Ubuntu 机器上有效,但在另一个 Ubuntu 机器上无效

这让我抓狂了:)

我正在尝试从 Synology 磁盘站 ssh 到 Ubuntu 服务器。我在 Synology 盒子上创建了一个密钥对:

ssh-keygen -v -t rsa -f ~/.ssh/backup-ubuntubox2 -P ""

并将 Synology 框中的 ~/.ssh/backup-ubuntubox2.pub 复制到 Ubuntu 框上的 ~/.ssh/authorized_keys。

它运行良好。

现在,我在另一台 Ubuntu 机器上做了完全相同的事情,但 ssh 一直提示我输入密码:

为什么???

backupsvc@NAS9:~/.ssh$ ssh rsyncuser@ubuntubox2 -i /var/services/homes/backupsvc/.ssh/backup-ubuntubox2 -v
OpenSSH_7.4p1, OpenSSL 1.0.2o-fips  27 Mar 2018
debug1: Connecting to ubuntubox2 [10.0.0.2] port 22.
debug1: Connection established.
debug1: identity file /var/services/homes/backupsvc/.ssh/backup-ubuntubox2 type 1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/backupsvc/.ssh/backup-ubuntubox2-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.8 pat OpenSSH* compat 0x04000000
debug1: Authenticating to ubuntubox2:22 as 'rsyncuser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:dNwmsFmQw2apTUYZWTBy6G0pd9hVA+OKS/Q5G1bmlfI
debug1: Host 'ubuntubox2' is known and matches the ECDSA host key.
debug1: Found key in /var/services/homes/backupsvc/.ssh/known_hosts:2
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/services/homes/backupsvc/.ssh/backup-ubuntubox2
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
rsyncuser@ubuntubox2's password:

相关内容