给Ubuntu20.04添加界面root自动登录

Tags:

默认是不允许的,我是参考了这篇文章,最后是可行的。

# 给root加密码 passwd
# 修改自动登录配置文件
sed -i.bak 's/^auth.*required.*pam_succeed_if.so user.*!=.*root.*quiet_success/#auth required        pam_succeed_if.so user != root quiet_success/g' /etc/pam.d/gdm-autologin
sed -i.bak 's/^auth.*required.*pam_succeed_if.so user.*!=.*root.*quiet_success/#auth required        pam_succeed_if.so user != root quiet_success/g' /etc/pam.d/gdm-password

echo -e "greeter-show-manual-login=true #手工输入登陆系统的用户名和密码\nallow-guest=false #不允许guest登录(可选)" >> /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

sed -i.bak 's/^\(mesg n 2.*\)/#\1/g'  /root/.profile
echo -e "tty -s && mesg n" >> /root/.profile

再修改一下这个 /etc/gdm3/custom.conf

Leave a Reply