【问题标题】:SSH Public Key for user without home directory没有主目录的用户的 SSH 公钥
【发布时间】:2010-10-14 09:15:33
【问题描述】:

我正在运行 Mac OS X Leopard 服务器,我创建了一个新用户,但没有为该用户指定主目录。是否可以让该用户使用公钥进行身份验证?

我知道当用户确实有一个主目录时,它会进入~/.ssh/authorized_keys

我不想为这个用户创建一个主目录,因为我的理解是,如果给予物理访问权限,它将允许他们登录。

更新:我只需要允许该用户进行安全 FTP 连接。将 Login Shell 设置为 /bin/false/ 也会阻止他们进行远程连接。

【问题讨论】:

    标签: macos ssh rsa osx-leopard


    【解决方案1】:

    您必须编辑/etc/ssh/sshd_config 或它在您机器上的位置并更改AuthorizedKeysFile 设置。

    文档说:

     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 fol-
             lowing 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''.
    

    但是为什么你有没有家的用户(可以登录)?

    【讨论】:

    • 我希望他们能够通过 SFTP 进入我指定的文件夹。我将 SFTP chroot 到了一个子文件夹。
    猜你喜欢
    • 2023-03-29
    • 2012-02-17
    • 2023-03-07
    • 1970-01-01
    • 2021-01-10
    • 1970-01-01
    • 2015-03-09
    • 1970-01-01
    • 2013-01-05
    相关资源
    最近更新 更多