内容目录
Ubuntu 中如何 root 直登
众所周知,Ubuntu在未特定设置前是无法使用 root 账户来直接登陆的,因此,需要我们手动设置,哈哈哈(ಡωಡ)hiahiahia,个人觉得 Ubuntu 总是让人丧失体验感,连 root 账户直登都得修改文件。这也或许是博主更青睐 Kali Linux 的原因吧,虽然它们同为 Debian 系列。
首先,博主的 Ubuntu 版本信息:
由于,Ubuntu 的特性,初次切换 root 账户或使用 sudo 命令时,均要重新修改一次密码:
xyl@ubuntu:~$ sudo passwd root [sudo] password for xyl: # 输入你账户的密码 New password: Retype new passwd: passwd:password updated successfully
切换 root 权限:
su - 或者 sudo -i 输入刚刚修改的密码
允许 root 登陆桌面显示器:
cd /usr/share/lightdm/lightdm.conf.d/ vi 50-ubuntu.conf
修改内容如下:
[Seat:*] user-session=ubuntu #Manually add user and passwd greeter-show-manual-login=true
禁用 guest 用户
all-guest=false
允许 root 身份开机自动登陆
#root Login autologin-user=root
那么,为什么要修改 Lightdm 文件呢,因为 LightDM 负责启动 X Server,用户会话和欢迎界面,我们也都知道 Linux 中一切皆文件的思想,因此,想要配置 root 直登就得修改对应的文件信息
解除 GNOME 桌面环境对 root 账户的限制:
分别修改 gdm-autologin、gdm-password 文件:
cd /etc/pam.d vi gdm-autologin vi gdm-password
均把 user != root quiet_success 不允许 root 身份登陆这行注释掉,这样在 gnome 桌面终端中就可以直接 root 身份了:root@ubuntu:~#
修改环境变量:
vi /root/.profile #有修改
不显示终端设备文件名,并且设置终端允许,发送消息:
tty -s && mesg n || true #上图的掉了 n,没有去改了。
最后,重启 Ubuntu 系统:
reboot
输入 root 账户密码即可登陆!!
相关文章
- 使用Jetson_benchmark进行性能测试(0)
- win10远程桌面连接ubuntu20(RDP)(0)
- ubuntu中查看各种设备和资源的命令汇总(0)
- Smart card authentication with SSH(0)
- Linux下查看在线用户并踢出(0)