【发布时间】:2014-03-06 17:19:18
【问题描述】:
我有几台具有以下 sshd 配置的服务器。
# Authentication:
PermitRootLogin no
AllowGroups ssh
PubkeyAuthentication yes
PasswordAuthentication no
这意味着“ssh”组中的每个用户都可以登录,但只能使用 pubkey。不允许root登录。
但root一定有一个例外:我的$ip备份服务器必须以root身份登录。
我试过了:
AllowUsers root@$ip
AllowGroups ssh
但是 AllowUsers 会覆盖 AllowGroups 语句。所以只有 $ip 的 root 才能登录。
Match User root, Address $ip
PermitRootLogin {yes|without-password}
AllowUsers root
和
Match Address $ip
PermitRootLogin {yes|without-password}
AllowUsers *
两者都被完全忽略。 “ssh”组中的普通用户仍然只能登录。
这是一个简单的场景,用户登录限制为 pubkey,root 登录限制为 pubkey 和某些 ip。如何解决?
【问题讨论】: