Ubuntu 22/24开启 root 远程登录

$ sudo su - root      // 切换为 root 用户
$ passwd              // 设置 root 用户密码
# ubuntu 22.04
$ sed -i "/#PermitRootLogin/ a PermitRootLogin yes" /etc/ssh/sshd_config \
  && systemctl restart sshd
# ubuntu 24.04
$ sed -i "/#PermitRootLogin/ a PermitRootLogin yes" /etc/ssh/sshd_config \
  && systemctl restart ssh

你可能感兴趣的:(ubuntu,ubuntu,linux,运维)