我在 Yosemite 上运行 Mac OS X Server.app,并且我为使用默认设置的用户启用了 SSH /etc/sshd_config
(默认情况下启用公钥和密码身份验证)。 但是,我需要限制git
本地用户只能通过 SSH 访问公钥。
完全公开,Server.app 启用了一些额外的 Kerberos 和 GSSAPI 选项(虽然我不是 100% 确定这些如何影响我下面的问题):
# Kerberos options
KerberosAuthentication yes
KerberosOrLocalPasswd yes
KerberosTicketCleanup yes
# GSSAPI options
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
GSSAPIStrictAcceptorCheck yes
GSSAPIKeyExchange no
Run Code Online (Sandbox Code Playgroud)
/etc/sshd_config
说如下:
# To disable tunneled clear text passwords both PasswordAuthentication and
# ChallengeResponseAuthentication must be set to "no".
Run Code Online (Sandbox Code Playgroud)
但是,ChallengeResponseAuthentication
match 语句中不允许使用,所以我尝试仅禁用密码身份验证:
Match User git
PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)
这不起作用——我仍然能够使用用户名/密码登录 git@my.server :(
但是,添加KbdInteractiveAuthentication no
似乎可以正常工作:
Match User …
Run Code Online (Sandbox Code Playgroud)