ssh-copy-id 不会更新 authorized_keys 文件

ssh-copy-id 不会更新 authorized_keys 文件

我无法在 Synology NAS 上配置 ssh 密钥。文件~/.ssh/authorized_keys未创建或未更新。

在远程机器 (NAS) 上:

$ cd
$ chmod 700 .
$ chmod 700 .ssh
$ touch .ssh/authorized_keys
$ chmod 600 .ssh/authorized_keys

我更新了/etc/ssh/sshd_config取消注释行:

PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

我重新启动了 sshd:

$ sudo synoservicectl --reload sshd

在本地机器上:

$ ssh-keygen -t ed25519 -C "[email protected]"
# key generated in custom location 'id_synology'

$ ssh-copy-id -i id_synology -f -p 2222 [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_synology.pub"
/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
/usr/bin/ssh-copy-id: line 251: warning: here-document at line 251 delimited by end-of-file (wanted `EOF')
/usr/bin/ssh-copy-id: line 250: warning: here-document at line 250 delimited by end-of-file (wanted `EOF')
/usr/bin/ssh-copy-id: line 260: EOF: command not found
[email protected]'s password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh -p '2222' '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

远程机器上authorized_keys没有更新。我尝试不使用authorized_keys,但文件没有创建。我也尝试使用 rsa 算法,带或不带密码,但结果相同。

有什么想法吗?或者有任何日志可以检查为什么密钥没有被复制?

相关内容