Ubuntu 设置 root 用户登录

设置 root 用户密码

# 设置root用户密码
# 输入两次root用户密码,最终返回password updated successfully,则表示密码设定成功
sudo passwd root

设置 root 用户登录

# 修改sshd配置文件
sudo vim /etc/ssh/sshd_config

# 反注释PermitRootLogin,并修改参数为yes
PermitRootLogin yes
# 反注释PasswordAuthentication,并修改参数为yes
PasswordAuthentication yes

# 按ESC,保存sshd_config
:wq

重启 SSH 服务

# 重启ssh服务
sudo systemctl restart sshd

root 用户登录测试

使用 root 账户直接登录服务器,登录成功则完成设置




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • SNAT和DNAT
  • Clickhouse Drop表过大异常
  • Jmeter使用指南
  • Excel导入图片URL并显示图片
  • Shell命令汇总