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登录,第四个会连接不上。