linux - ssh-copy-id 不会复制到 sshd_config 中指定的自定义 'AuthorizedKeysFile'

标签 linux ssh sshd authorized-keys

我修改了用户授权 key 的位置,包括远离 /<user>/.ssh 的 root key 。至/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 将 key 添加到指向的正确位置 /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#

谢谢!

最佳答案

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

关于linux - ssh-copy-id 不会复制到 sshd_config 中指定的自定义 'AuthorizedKeysFile',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31125671/

相关文章:

linux - anaconda env 的 TensorFlow 问题

php - 如何设置open_basedir的值?

windows - 从 Git Gui (windows) 推送到远程 Git 存储库的问题

java - 使用Java通过SSH隧道传输文件

linux - 在 SSHD 配置中, "MaxStartups 10:30:60"是什么意思?

linux - shell脚本-shell脚本多次提示时输入重定向

子文件夹中的正则表达式多行匹配递归(一个类轮)

session - 如何在没有 screen 或 tmux 的情况下重新连接到意外断开的 ssh session

echo - Apache MINA SSHD session 在使用 ProcessShellFactory 时回显字符两次,控制字符不起作用

linux - 在 Windows 7 上设置 OpenSSH 服务器以进行基于 key 的身份验证