我为我的用户的 authorized_keys 修改了位置,包括 root 的 from /<user>/.ssh
to /abc/%u
。
[root@server]# grep AuthorizedKeysFile /etc/ssh/sshd_config
#AuthorizedKeysFile .ssh/authorized_keys
AuthorizedKeysFile /abc/%u
但是 ssh-copy-id 似乎不使用来自远程服务器的信息,而是总是复制到“.ssh/authorized_keys”,如下面的快照中建议的那样。有什么方法可以明确要求 ssh-copy-id 将密钥添加到/abc/%u
服务器上 AuthorizedKeysFile 指向的正确位置?
root@client# ssh-copy-id root@server
Password: ********
Now try logging into the machine, with "ssh 'root@server'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
root@client#
谢谢!