CentOS 6.10修改SSH端口笔记


[root@localhost ~]# vim /etc/ssh/sshd_config 
#Port 22
Port 18022 #新增ssh端口
[root@localhost ~]# service sshd restart
[root@localhost ~]# 
[root@localhost ~]# vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 18022 -j ACCEPT #新增防火墙端口
[root@localhost ~]# service iptables restart


评论

  • *
  • *
精彩评论
  • ryan
    回复
    2018-11-17 23:43:06

    老夫哥,你该换升级CentOS,使用firewall-cmd了,这个新工具挺好用的,看起来更加像自然语言,而且支持永久生效,不需要手动写配置文件。

    • cwen
      回复
      2018-11-18 11:23:19

      @ryan 生产还全部是6的,6.10是前些天才发布的版本