CentOS7 系统安全配置

一、禁止root远程直接登录

创建普通用户,并设置密码

useradd test   #新建账户
passwd test    #设置密码

不允许root远程直接登录

vim /etc/ssh/sshd_config

找到 # PermitRootLogin yes   
修改为 PermitRootLogin no

重启 sshd 服务

systemctl restart sshd.service

二、修改ssh的端口

修改 ssh 端口

vi /etc/ssh/sshd_config

找到 #Port 22  
修改为 Port 36322

重启 sshd 服务

systemctl restart sshd.service
posted @ 2021-04-19 21:20  清汤自打  阅读(173)  评论(0编辑  收藏  举报