Ubuntu系统中,默认root不能登录图形界面,普通用户需要使用root权限时,只能通过sudo [命令] [参数] 临时使用root权限,或是使用su root切换到root用户权限下进行操作。
sudo passwd root
输入两遍密码;
返回如下信息,即表示 root 密码设置成功;
passwd: password updated successfully

命令:
vim /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
在文件尾加入两行:
greeter-show-manual-login=true
all-guest=false

路径:
/etc/pam.d/gdm-autologin
命令:
vim /etc/pam.d/gdm-autologin
操作:
注释掉auth required pam_success_if.so user!=root quiet_success 这一行
#auth required pam_succeed_if.so user != root quiet_success

路径:
/etc/pam.d/gdm-password
命令:
vim /etc/pam.d/gdm-password
操作:注释掉#auth required pam_succeed_if.so user != root quiet_success 这一行
#auth required pam_succeed_if.so user != root quiet_success

将 mesg n 改为 tty -s && mesg n
vim /root/.profile
未修改前:
root@test-virtual-machine:/# cat /root/.profile
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n 2> /dev/null || true
修改后
root@test-virtual-machine:/# cat /root/.profile
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
tty -s && mesg n 2> /dev/null || true
重启系统后,登录选择Not Listed?

输入root用户名与密码进行登录

