有没有办法配置SSH来检查多个用户的单个authorized_keys文件?我知道我可以将公钥复制到每个用户的authorized_keys文件中,但为了便于管理,我想为管理员提供一个额外的authorized_keys文件,允许他们登录所有用户(或特定的用户组).
解决方法
您可以使用/ etc / ssh / sshd_config中的AuthorizedKeysFile指令来执行此操作. defaut位置是.ssh / authorized_keys但你可以使用包含绝对路径的东西,例如
AuthorizedKeysFile /path/to/your/keyfile
手册页说明了这一点
AuthorizedKeysFile
Specifies the file that contains the public keys that can be used for user authentication. AuthorizedKeysFile may contain tokens of the form %T which are substituted during connection setup. The following tokens are defined: %% is replaced by a literal ’%’,%h is replaced by the home directory of the user being authenticated,and %u is replaced by the username of that user. After expansion,AuthorizedKeysFile is taken to be an absolute path or one relative to the user’s home directory. The default is “.ssh/authorized_keys”.