Ubuntu 22.04 LTS 开启 root 远程登录
Ubuntu 22.04 LTS 开启 root 远程登录前言:
Ubuntu 22.04 默认不开启root用户
开启 root配置操作:
1. 以普通用户登录系统,创建root用户的密码
sudo passwd root
2.修改 sshd_config
运行如下两行命令代码:
sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;
sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
或者直接修改 /etc/ssh/sshd_config 配置文件
nano /etc/ssh/sshd_config
添加上
#PermitRootLogin prohibit-password
PermitRootLogin yes # 允许root直接登录
PasswordAuthentication yes
3.重启ssh服务
sudo service sshd restart
页:
[1]