Ubuntu16.04中启用root用户,以及root用户自动登录

第一步是给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文件,增加tty -s &&:

sudo gedit /root/.profile 
复制代码
# ~/.profile: executed by Bourne-compatible login shells.

if [ "$BASH" ]; then
  if [ -f ~/.bashrc ]; then
    . ~/.bashrc
  fi
fi

tty -s && mesg n || true
复制代码

然后重启

posted @ 2022-09-22 16:01  ahuo  阅读(352)  评论(0编辑  收藏  举报