I've running last version Raspbian.

Edit a file /etc/systemd/system/autologin@.service and changed the one occurence of 'pi' in that file to 'root'.

Edit a file /etc/lightdm/lightdm.conf and changed 'autologin-user=pi' in that file to 'autologin-user=root'.

And i've used sudo raspi-config --> Boot Options --> Desktop Autologin but after rebooting I'm still asked to enter my username and password.

  • 3
    Can you login as root manually? By default Raspbian (and most Debian distributions) DO NOT have a root login. – Milliways Nov 13 '19 at 9:02
  • 2
    Why do you want to auto login as root? – CoderMike Nov 13 '19 at 9:58
  • 2
    This is a bad idea from a security perspective. It puts mot only your Pi and its' data at risk, but every device connected to your network. – Steve Robillard Nov 13 '19 at 12:55
  • @SteveRobillard That is somewhat true, assuming that (1) the Pi is accessible via the network, and (2) the pi user doesn't have passwordless sudo which makes it equalt to root security-wise. I used to have autologin as root on a board I used for hardware experiments: not having to deal with permissions actually saves some time. – Dmitry Grigoryev Nov 13 '19 at 15:11
  • If I read this in a year: what is the last version Raspbian? – Ingo Nov 14 '19 at 17:31

Passwordless root login on Raspbian is disabled in /etc/pam.d/lightdm-autologin:

auth required pam_succeed_if.so user != root quiet_success

Replace that line with a rule which would allow root. For example

auth sufficient pam_succeed_if.so user = root

You could also authorize passwordless login for users of a certain group. For instance, create an autologin group and add the root user to it:

groupadd -r autologin
gpasswd -a root autologin

Then specify the following rule, (again, in /etc/pam.d/lightdm-autologin):

auth sufficient pam_succeed_if.so user ingroup autologin

If you have further problems, post your /var/log/lightdm/lightdm.log

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.