<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[刘新修]]></title> 
<link>http://pic1.liuxinxiu.com:80/index.php</link> 
<description><![CDATA[刘新修的个人博客 (Liuxinxiu'S Blog)]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[刘新修]]></copyright>
<item>
<link>http://pic1.liuxinxiu.com:80/ssh_change_port/</link>
<title><![CDATA[【原创】更改SSH默认22端口或增加SSH端口的修改方法]]></title> 
<author>刘新修 &lt;admin@yourname.com&gt;</author>
<category><![CDATA[Linux/Unix]]></category>
<pubDate>Mon, 18 Oct 2010 03:39:25 +0000</pubDate> 
<guid>http://pic1.liuxinxiu.com:80/ssh_change_port/</guid> 
<description>
<![CDATA[ 
	<p><strong>以下教程以Fedora-13 为例</strong></p><p><strong>首先查看SELinux是否是开启状态，如果默认是开启<span style="color: #ff0000">先暂时关闭</span></strong></p><p>// 查看SELinux的当前模式<br /># getenforce</p><p>// 设置SELinux的当前模式，1设为Enforcing，2设为Permissive<br /># setenforce 1&#124;0</p><p><a target="_blank" href="http://at.liuxinxiu.com/2010/10/image/ssh_port1.jpg"><img height="80" alt="" width="398" src="http://at.liuxinxiu.com/2010/10/image/ssh_port1.jpg" /></a></p><p>=====================================================</p><p>vi /etc/ssh/sshd_config</p><p><a target="_blank" href="http://at.liuxinxiu.com/2010/10/image/ssh_port2.jpg"><img height="55" alt="" width="543" src="http://at.liuxinxiu.com/2010/10/image/ssh_port2.jpg" /></a></p><p>查找：#Port 22 去掉之前的# 并在以下新增加新端口999</p><p>Port 22<br />Port 999</p><p><a target="_blank" href="http://at.liuxinxiu.com/2010/10/image/ssh_port3.jpg"><img height="358" alt="" width="357" src="http://at.liuxinxiu.com/2010/10/image/ssh_port3.jpg" /></a></p><p><br />无论你是想增加新端口999 还说想更改默认22端口为999</p><p>建议先保存22和999 请先同时保存两个端口以避免修改中出现失误导致无法登入到远程服务器！</p><p>之所以先设置成两个端口，测试成功后再关闭一个端口，是为了方式在修改conf的过程中，万一出现掉线、断网、误操作等未知情况时候，还能通过另外一个端口连接上去调试以免发生连接不上必须派人去机房，导致问题更加复杂麻烦。</p><p>更改完成并保存！重启SSHD：</p><p>*************************************************************************************</p><p>service sshd restart 或者 /etc/init.d/sshd restart</p><p>*************************************************************************************</p><p>然后修改防火墙规则：</p><p>vi /etc/sysconfig/iptables</p><p>添加新端口：-A INPUT -m state --state NEW -m tcp -p tcp --dport 999 -j ACCEPT</p><p><a target="_blank" href="http://at.liuxinxiu.com/2010/10/image/ssh_port4.jpg"><img height="309" alt="" width="697" src="http://at.liuxinxiu.com/2010/10/image/ssh_port4.jpg" /></a></p><p>*************************************************************************************</p><p>保存之后重启防火墙规则：/etc/init.d/iptables restart 或者 service iptables restart</p><p>*************************************************************************************</p><p>现在请使用ssh工具连接999端口，来测试是否成功。如果连接成功了，则再次编辑sshd_config的设置，将里边的Port22删除，即可。</p><p>&nbsp;</p>
]]>
</description>
</item><item>
<link>http://pic1.liuxinxiu.com:80/ssh_change_port/#blogcomment</link>
<title><![CDATA[[评论] 【原创】更改SSH默认22端口或增加SSH端口的修改方法]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://pic1.liuxinxiu.com:80/ssh_change_port/#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>