-
安装OpenSSH
- sudo apt-get install openssh-server openssh-client
- sudo yum install openssh-server openssh-client
-
查看22端口是否开通
- netstat -tnl
-
开通22端口
-
关闭防火墙
systemctl stop firewalld
systemctl mask firewalld
-
安装iptables-services
yum install iptables-services
-
设置开机启动
systemctl enable iptables
-
保存设置
service iptables save
-
编辑防火墙打开22端口
vi /etc/sysconfig/iptables
-
加入如下命令
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-
重启防火墙
service iptables restart
转载请注明出处