首页 > 技术文章 > 配置ssh

waitfate 2015-02-15 11:37 原文

 

  首先肯定要先更改ssh的端口号,比如:8899 以及安全选项

gedit /etc/ssh/sshd_config

PermitRootLogin no

MaxAuthTries 3

AllowUsers *****

更改Port参数

Port=8899

然后更改services文件ssh端口号

gedit /etc/services

更改对应ssh的tcp和udp端口 都为8899

ssh             8899/tcp                          # The Secure Shell (SSH) Protocol
ssh             8899/udp                          # The Secure Shell (SSH) Protocol

然后重启sshd服务

service sshd restart

然后防火墙中更改默认的22端口为8899端口

gedit /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8899 -j ACCEPT

重启防火墙是规则生效

service iptables restart

现在就可以用putty使用8899端口连接了。

推荐阅读