0

我为我的用户的 authorized_keys 修改了位置,包括 root 的 from /<user>/.sshto /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#

谢谢!

4

1 回答 1

0

使用 $HOME/.ssh/config 指定您正在运行的用户配置,并设置 IdentityFile 选项。Nixcraft 在 [ http://www.cyberciti.biz/faq/create-ssh-config-file-on-linux-unix/]上有一些很好的例子

于 2015-06-29T21:52:43.367 回答