修改ssh端口及配置

#增加普通用户
useradd testuser
passwd testuser

#将此普通用户追加到root组
usermod -aG root testuser
id testuser

#尝试使用testuser远程登录系统

#查看安装的ssh软件包
rpm -qa | grep ssh

#查询软件包的配置文件名
rpm -qc openssh-server

#编辑配置文件
vim /etc/ssh/sshd_config

1)Port 22 这一行默认是注释的(大约在13行处),取消注释或者添加一行 Port 新端口号,如配置新端口号为9999:
#Port 22
Port 9999

2)将PermitRootLogin改为no,该参数默认为yes,(大约在132行处,配置文件的末尾)
#PermitRootLogin yes
PermitRootLogin no

3)重启ssh服务
service sshd restart

本文作者: GavinDong

版权属于: GavinDong博客

文章链接: https://gavindong.com/2004.html

如果使用过程中遇到问题,可 **点击此处** 交流沟通。

版权所有,转载时必须以链接形式注明作者和原始出处及本声明。

(0)

发表回复

登录后才能评论