【问题标题】:How to prevent multiple connections in SSH? [closed]如何防止 SSH 中的多个连接? [关闭]
【发布时间】:2016-03-04 08:39:44
【问题描述】:

我有一个 Linux 服务器。 SSH配置好(顺便说一下我访问服务器的唯一方式)。

现在,让我们以一个用户为例,例如我 (pofilo)。

我只希望用户 pofilo 在 SSH 同时 一个连接(这意味着如果有人已经在已连接)。

【问题讨论】:

  • 看起来 PAM 模块 pam_limits.so 可以帮助解决这个问题。见这里:askubuntu.com/questions/400893/… 我在其他类似问题上也看到过这个模块,所以这可能是最好的选择。
  • 如果您需要区分 SSH 登录和其他登录,并且只限制 SSH 登录,您可能最好使用 SSH 强制命令和您自己的包装脚本。

标签: linux bash ssh server


【解决方案1】:

您可以在 /etc/security/limits.conf 中设置最大登录次数(针对用户或组)。

如果你需要一个例子:

echo "@loginrestriction  -  maxlogins 4" >> /etc/security/limits.conf
echo "username  -  maxlogins 1" >> /etc/security/limits.conf
useradd -G loginrestriction a_username

【讨论】:

猜你喜欢
  • 2017-04-05
  • 2018-02-06
  • 1970-01-01
  • 1970-01-01
  • 2011-10-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多