Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux ssh复制id不复制到自定义';授权密钥文件';在sshd_配置中指定_Linux_Ssh_Sshd_Authorized Keys - Fatal编程技术网

Linux ssh复制id不复制到自定义';授权密钥文件';在sshd_配置中指定

Linux ssh复制id不复制到自定义';授权密钥文件';在sshd_配置中指定,linux,ssh,sshd,authorized-keys,Linux,Ssh,Sshd,Authorized Keys,我已修改了用户授权密钥的位置,包括root用户从/.ssh到/abc/%u的位置 [root@server]# grep AuthorizedKeysFile /etc/ssh/sshd_config #AuthorizedKeysFile .ssh/authorized_keys AuthorizedKeysFile /abc/%u 但ssh副本id似乎不使用来自远程服务器的信息,而是始终复制到快照中建议的“.ssh/authorized_keys”。有没有办法明确要求ssh copy i

我已修改了用户授权密钥的位置,包括root用户从
/.ssh
/abc/%u
的位置

[root@server]# grep AuthorizedKeysFile /etc/ssh/sshd_config
#AuthorizedKeysFile .ssh/authorized_keys
AuthorizedKeysFile  /abc/%u
但ssh副本id似乎不使用来自远程服务器的信息,而是始终复制到快照中建议的“.ssh/authorized_keys”。有没有办法明确要求ssh copy id将密钥添加到服务器上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在[

上有一些很好的例子,谢谢你的回答。不幸的是,我无法控制服务器配置。我只有关于对全局sshd_配置文件进行定制的信息,我需要使用那里提供的路径“AuthorizedKeysFile/abc/%u”。我能想到的唯一解决方案是生成~/.ssh/authorized_密钥并将其复制到/abc/或者您可以将其与ln-s ~/.ssh/authorized_密钥/some/other/location进行象征性链接。我感到困惑,因为如果您正试图这样做的话,移动文件并不会真正让事情变得更安全。@Faern本地的新用户可以创建一个te一个允许用户授予密钥远程访问权限的授权密钥文件,将这些文件移动到受限位置是配置文件授予密钥访问权限的控制层。具体取决于您的结构(例如
/abc/%u
)手动设置、比较、审核和更新也更容易。删除配置文件后会留下一些负面信息,如auth文件,但根据您的使用情况,这可能不是一个问题。我想这更多是关于控制而不是安全