Linux 限制root用户远程登录-ssh

1.首先执行备份:
#cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_bak
2.确保系统存在除root之外的其他用户,防止设备配置完之后用户无法远程访问),若不存在其他用户,则使用如下命令添加用户并配置强密码:
#useradd username
#passwd username
3.配置禁止root用户直接远程登录系统
编辑文件/etc/ssh/sshd_config,修改PermitRootLogin值为no
PermitRootLogin no 
4.修改ssh协议版本
编辑文件/etc/ssh/sshd_config,修改Protocol的值为2 
Protocol 2
5、重启ssh服务
#/etc/init.d/sshd restart

 

转载自:https://blog.csdn.net/qq_38101240/article/details/133793300

posted @ 2024-03-29 20:18  .dier  阅读(15)  评论(0编辑  收藏  举报