ubuntu16.04用户root自动登陆

转载:https://blog.csdn.net/hxh5801050/article/details/77801050

第一步:给root用户设置个密码
没试过空密码行不行,不折腾.

sudo passwd root

第二步:在配置文件里设置自启动
1、编辑/etc/lightdm/lightdm.conf:
sudo gedit /etc/lightdm/lightdm.conf

添加如下:
[Seat:*]
autologin-guest=false
autologin-user=root
autologin-user-timeout=0
greeter-session=lightdm-gtk-greeter

2、编辑/root/.profile文件:
sudo gedit /root/.profile

最后一行改成tty -s && mesg n || true,重启后自动进入root用户:

#~/.profile: executed by Bourne-compatible login shells.
if [ “$BASH” ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi

tty -s && mesg n || true

猜你喜欢

转载自blog.csdn.net/weixin_41536025/article/details/85565701