Copyright 2025 HNCloud Limited.
香港联合通讯国际有限公司
Ubuntu配置单root用户登录方法
时间 : 2025-01-23 09:50:30
编辑 : 华纳云
阅读量 : 42
本篇文章中重点为大家讲解一下Ubuntu配置单root用户登录方法,有需要的小伙伴可以参考一下。
shell命令
sudo vim usr/share/lightdm.conf.d/50-ubuntu.conf //编辑器不限
[SeatDefaults]
user-session=ubuntu
greeter-show-manual-login=true #手工输入登录系统的账号密码
allow-guest=false #禁止guest登录
修改root密码
sudo passwd root
修改/root/.profile
sudo vim /root/.profile //root首次登录会报错解决方法
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
#mesg n 注释掉mesg n 增加一行tty -s && mesg n
tty -s && mesg n
修改ssh配置文件允许root登录
sudo vim /etc/ssh/sshd_config
#permitRootLogin without-password 注释掉这行,新增下面一行
permitRootLogin yes
重启ssh服务即可