1、设置密码
# sudo passwd root
2、启用 root 用户
# sudo passd --unlock root
3、开启 root 用户 ssh 登录的权限。修改 /etc/ssh/sshd_config 文件,新增一行 PermitRootLogin yes,(此步骤可忽略)
PermitRootLogin yes UsePAM yes
4、修改 /etc/systemd/system/autologin@.service,将 pi 修改为 root
ExecStart=-/sbin/agetty --noclear --autologin your_user_name %I $TERM
5、修改 /etc/lightdm/lightdm.conf,将 autologin-user=pi 修改为 autologin-user=root
user-session=root autologin-user=root
6、修改 /etc/pam.d/lightdm-autologin,将 user != root 修改为 user != t (此处 t 表示其他用户,或者可以将user != root 修改为 user == root)
# Allow access without authentication auth required pam_succeed_if.so user != t quiet_success auth required pam_permit.so
7、重启
# reboot
参考文档:
1、raspi config - How to enable auto-login? - Raspberry Pi Stack Exchange
2、linux - Automatic root login in Debian 8.0 (console only) - Super User
3、Raspberry Pi: Autologin root user without login and password window - YouTube