1. 程式人生 > >ubuntu16.04使用者root自動登陸

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