1

tl;dr Can I override the auto-login feature sometimes, to log in as root?

My Pi is running Raspbian Jessie and acting as a kiosk in a public location. For this reason I have renamed the pi user and removed sudo privileges.

To get auto-login working I used the raspi-config command, boot options, CLI auto-login, to generate an autologin service file in /etc/systemd/system/autologin@.service and changed the username in that file. This works great.

Normally I will use ssh to remotely administer it, but in case of network failure I'd like the ability to log in locally.

However even if I exit from the terminal it logs me right back in. Is there a way to override this and log in as root?

1

I discovered I can use the keyboard combination CTRL+Alt+Fn (F1-F7) to switch between different virtual terminals. Only the first terminal (F1) will automatically login, so I can use different credentials on the others.

However I don't think this is documented behaviour. I believe that service file should run on all virtual terminals and not just the first one, so if behaviour changes in the future then this guide for Arch might be relevant:

Create a new file for terminal 1 '/lib/systemd/system/getty@tty1.service' and copy into it the config you defined above.

In /lib/systemd/system/getty@.service use the following:

ExecStart=-/sbin/agetty --noclear %I $TERM

Console 1 will autologin [..] all other consoles will prompt for credentials.
1

Assuming your kiosk is using GUI: LightDM has a configuration parameter called autologin-user-timeout. This is usually set to zero, meaning the autologin is triggered automatically. Setting it to a non-zero value (e.g. autologin-user-timeout=10) will give you a chance to type in your username and password at startup.

If have command line access, you don't have to log out to change users. Simply run su as the autologged-in user and you will be asked for a root password. Typing exit once you're done will log you out as root and return you to the user terminal.

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.