小编sta*_*xyz的帖子

从外部网络拒绝特定用户的 SSH

所以我在本地网络上有一台运行 OpenSSH 服务器的服务器。服务器配置为允许来自外部网络的 SSH,这是预期的。但是,我想创建一个特定用户 (localUser),该用户不得从我的 LAN 外部登录。

目前我有一个名为 sshusers 的组,它是唯一允许通过 SSH 登录的组。

根据手册页,应该可以使用“允许/拒绝”用户,但我不知道如何去做。这是我尝试过的:

第一次尝试:

AllowGroups sshusers
AllowUsers localUser@192.168.2.* # 2 is not a typo
# localUser not in group sshusers. Intention: AllowUsers should override
# previous configuration, allowing access for localUser, even if he is
# not member of sshusers
Run Code Online (Sandbox Code Playgroud)

第二次尝试:

AllowGroups sshusers
DenyUsers localUser@!192.168.2.*
# localUser is member of sshusers. Intention: Access is granted, but with
# the negotiation of the match-expression for the LAN, access should be
# …
Run Code Online (Sandbox Code Playgroud)

ssh

6
推荐指数
1
解决办法
5417
查看次数

标签 统计

ssh ×1