我是靠谱客的博主 追寻方盒,这篇文章主要介绍Linux安全加固之修改SSH登录端口,现在分享给大家,希望可以做个参考。

        Linux的默认登录端口是22,这种默认端口往往本身就存在一定的风险,为了加固Linux的安全性,可以通过修改SSH的默认登录端口来实现,操作比较简单,只要三步就行

1. 修改配置文件

使用命令进入配置文件编辑页面

复制代码
1
[root@VM-4-16-centos ~]# vim /etc/ssh/sshd_config

2. 修改port

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $ # This is the sshd server system-wide configuration file. See # sshd_config(5) for more information. # This sshd was compiled with PATH=/usr/local/bin:/usr/bin # The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value. # If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # #Port 22 这个22是默认端口,修改的话,就放开这个注释,修改你自己想要的端口 Port 10086 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: HostKey /etc/ssh/ssh_host_rsa_key #HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key # Ciphers and keying #RekeyLimit default none

3. 重启SSH服务

通过命令重启SSH服务

复制代码
1
[root@VM-4-16-centos ~]# systemctl restart sshd

然后退出重新修改端口登录Linux服务即可!

最后

以上就是追寻方盒最近收集整理的关于Linux安全加固之修改SSH登录端口的全部内容,更多相关Linux安全加固之修改SSH登录端口内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部