Home / 主机知识 / 如何修改root端口

如何修改root端口

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 root@192.168.1.90
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 root@192.168.1.90 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.

About admin

Check Also

win2012评估版转正式版

把版本转换成正式版本: 这条命令是转换成数据中心版本: DISM /online /Set-Edition:ServerDatacenter /AcceptEula /ProductKey:XXXXXXXXXXXXX 这条命令是转换成标准版本: DISM /online /Set-Edition:ServerStandard /AcceptEula /ProductKey:XXXXXXXXXXXXX 服务器将重启两次 Windows Server 2012 R2 Standard RETAIL KEY Q8MTR-F2N87-JPQ4C-8CFK9-C7HJM HK69K-3N8Y2-VB2XH-4HYGY-CWDWM W689N-TPP83-V2Q42-683JR-X2C2B

发表回复