Centos修改SSH端口号

Posted by 冰河 at 03:12 Add comments 28,222 Views
072012

1.添加端口

vim /etc/ssh/sshd_config

将#Port 22的注释去掉并且换行加入Port 443

如果是不是增加,而是修改端口的话,建议先保留22端口,等新端口可以登录再去掉。

443其实是https使用的端口,3128是squid使用的端口。建议使用大端口,比如10000~65535以上。

重启SSH服务 /etc/init.d/sshd restart
或者
Centos:service sshd restart
Debian:service ssh restart

2.防火墙开启443端口
vi /etc/sysconfig/iptables

加入-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

或者

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
service iptables save

重启防火墙 /etc/init.d/iptables restart

#ClientAliveInterval 60
#ClientAliveCountMax 3

相关日志

2 Responses to “Centos修改SSH端口号”

  1. 我也有一个buyvm下面的一个vps 。 但是我在控制界面中重装一个系统之后,发现ssh登入进去还是之前的系统。这个问题应该怎么搞。

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Protected by WP Anti Spam
© 2009 - 2024 冰河的博客