Linux下修改22端口
Linux中SSH默認端口爲22,爲了安全考慮,我們有必要對22端口進行修改,現修改端口爲60000;修改方法如下:
在/etc/ssh/sshd_config中找到Port 22,將其修改爲60000,或使用/usr/sbin/sshd -p 60000指定端口。
[root@localhost /]# vi /etc/ssh/sshd_config
Port 60000
[root@localhost /]# /usr/sbin/sshd -p 60000
[root@localhost /]# service sshd restart
停止 sshd: [ 確定 ]
啓動 sshd [ 確定 ]
如果用戶想讓22和60000端口同時開放,只需在/etc/ssh/sshd_config增加一行內容如下:
[root@localhost /]# vi /etc/ssh/sshd_config
Port 22
Port 60000
保存並退出
[root@localhost /]# /etc/init.d/sshd restart
停止 sshd: [ 確定 ]
啓動 sshd [ 確定 ]
測試
Xshell:\> ssh [email protected]
Connecting to 192.168.1.90:22...
Connection established.
Escape character is ^@].
Last login: Sun Mar 14 22:44:44 2010 from www-72cbd3ffe95.
[root@localhost ~]#
Xshell:\> ssh [email protected] 60000
Connecting to 192.168.1.90:60000...
Connection established.
Escape character is ^@].
Last login: Sun Mar 14 22:47:47 2010 from www-72cbd3ffe95.