dora@ubuntu:~$ sudo passwd root
[sudo] password for dora:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
sudo gedit /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
在文件中添加如下内容
autologin-user=root
greeter-session=lightdm-gtk-greeter
sudo gedit /root/.profile
在原文件的的最后一行的最前面加上tty -s && ,就像这样
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
tty -s && mesg n || true
重启之后,便是默认root用户了