我是靠谱客的博主 柔弱诺言,这篇文章主要介绍CentOS xinetd+ssh 实现限制ssh连接数量,现在分享给大家,希望可以做个参考。

1.安装ssh和xinetd

yum install openssl openssh-server
yum install xinetd

2.将ssh关闭并且禁止开机启动

systemctl stop sshd.service
systemctl disable sshd.service

3.在/etc/xinetd.conf添加如下代码(具体含义可以man xinetd.conf查询):

service ssh
{
        socket_type = stream
        wait        = no
        nice        = 1
        user        = root
        server      = /usr/sbin/sshd
        server_args = -i
        instances   = 3
        flags       = IPv4
}

flags是ipv4,如果要使用ipv6,设置为IPv6;instances是连接的数量,这里设置为3

4.重启xinetd

5.使用xshell登录,发现下面情况,网上查找,需要把/etc/sysconfig/selinux中SELINUX置为disabled并重启。

然后在xshell登录,第四个会连接不上。

最后

以上就是柔弱诺言最近收集整理的关于CentOS xinetd+ssh 实现限制ssh连接数量的全部内容,更多相关CentOS内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(126)

评论列表共有 0 条评论

立即
投稿
返回
顶部