AuthorizedKeysFile 行被注释掉但似乎仍然有效

AuthorizedKeysFile 行被注释掉但似乎仍然有效

我正在 Linode 上设置服务器,并遵循他们的保护您的服务器指导。

他们建议设置 ssh 密钥对身份验证。我已经将我的公钥上传到服务器,密钥对身份验证似乎工作正常,但如果以下行被注释掉,它如何工作sshd_config

#AuthorizedKeysFile     %h/.ssh/authorized_keys

答案1

这是默认位置。您可以使用AuthorizedKeysFile更改为其他位置,但如果未指定,则它将查找~/.ssh/authorized_keys

从手册页(例如,https://www.freebsd.org/cgi/man.cgi?query=sshd_config&sektion=5):

授权密钥文件

   Specifies the file that contains the public keys that can be used
   for user authentication.  The format is described in the AUTHO-
   RIZED_KEYS FILE FORMAT section of sshd(8).  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 user-
   name of that user.  After expansion, AuthorizedKeysFile is taken
   to be an absolute path or one relative to the user's home direc-
   tory.  Multiple files may be listed, separated by whitespace.
   The default is ``.ssh/authorized_keys .ssh/authorized_keys2''.

相关内容