【问题标题】:sshd Authorized key command not authenticating userssh 授权的密钥命令不验证用户
【发布时间】:2016-10-26 09:23:26
【问题描述】:

我正在使用 Simple AD 对 RHEL 7.2 服务器上的 SSH 用户进行身份验证。我已经修改了 AD 上的架构以包含 sshPublicKey 和 ldapPublicKey 的 LDAP 参数,并为我的用户将公钥导入到 AD。

我可以使用密码登录对 AD 罚款进行身份验证。我可以使用以下命令从 AD 返回 SSH 密钥

/usr/bin/sss_ssh_authorizedkeys user@domain.example.com

我什至可以手动将返回的密钥复制到 /home/user@domain.example.com/.ssh/authorized_keys 并且可以正常登录。

但是,当我将以下内容添加到 sshd_config 并重新启动 sshd 时,我无法进行身份验证(只是获得权限被拒绝)

AuthorizedKeysCommand /usr/bin/sss_ssh_authorizedkeys
AuthorizedKeysCommandUser root

总而言之,我可以使用密码对 AD 罚款进行身份验证,我可以从 AD 罚款中返回公钥(并在我手动将其复制到授权密钥时对密钥进行身份验证)但我无法让它工作使用 sshd 的 AuthorizedKeysCommand

【问题讨论】:

    标签: authentication ssh ldap rhel7


    【解决方案1】:

    原来在 AuthorizedKeysCommand 文件之后只有一些额外的空格。通过使用调试启动 sshd 注意到它:

    systemctl stop sshd
    /usr/sbin/sshd -d
    

    然后我在尝试 ssh 连接时看到:

    Could not stat AuthorizedKeysCommand "/usr/bin/sss_ssh_authorizedkeys  ": No such file or directory
    

    【讨论】:

      猜你喜欢
      • 2017-11-06
      • 1970-01-01
      • 2018-11-18
      • 1970-01-01
      • 1970-01-01
      • 2013-07-23
      • 2016-02-24
      • 2013-06-14
      • 2017-04-28
      相关资源
      最近更新 更多