Is there a way to auto login as root at startup with Raspbian Jessie like there are auto login for user pi?
- 4This is a major security hole. Why do you want to do this?Steve Robillard– Steve Robillard2016-04-09 20:54:51 +00:00Commented Apr 9, 2016 at 20:54
- 1to save time, because always login as root anywayRedex– Redex2016-04-09 20:59:22 +00:00Commented Apr 9, 2016 at 20:59
- 4So taking 10 seconds to login is worth hosing your system? There is nothing you can't do as the Pi user with sudo.Steve Robillard– Steve Robillard2016-04-09 21:00:11 +00:00Commented Apr 9, 2016 at 21:00
- 2If you're using a Unix based OS and logging in as root regularly you're doing it wrong.Matti Virkkunen– Matti Virkkunen2016-04-10 20:54:20 +00:00Commented Apr 10, 2016 at 20:54
- 4I feel like the downvotes on this question are poor form. It's a foolish choice on Redex's part, but it's not a bad question.Jacobm001– Jacobm0012016-04-11 21:16:03 +00:00Commented Apr 11, 2016 at 21:16
3 Answers
MariusMatutiaes accepted answer worked for Raspbian Jessie (March 2016) too:
Edit the file /lib/systemd/system/[email protected] and change the line
ExecStart=-/sbin/agetty --noclear %I $TERM to
ExecStart=-/sbin/getty/ --noclear -a root %I $TERM Reference: https://superuser.com/a/970013
I'm not sure why you would want to autologin as root, but if its just for the sake of saving those few seconds you can choose to auto login with the pi username in the raspi-config settings:
- 3I know, but Pi-user isn't root and needs sudo-command and I was asking automatically login as root...Redex– Redex2016-04-11 20:09:33 +00:00Commented Apr 11, 2016 at 20:09
- From a security point of view autologin is a bad choice, but this is moderately better solution (and hence a valid answer)Steve Robillard– Steve Robillard2016-05-26 20:05:40 +00:00Commented May 26, 2016 at 20:05
- I tried this with B2 option and all works as expected. Do you know what files raspi-config actually changes when setting this auto login option ? All I can see it doing is creating a symbolic link between default.target and multi-user.target inside systemd services folders. How does it work ?Shady Programmer– Shady Programmer2016-12-23 11:37:37 +00:00Commented Dec 23, 2016 at 11:37
- 1Q: How to login as
root? A: Login aspi. This doesn't answer the question, regardless of which is a better idea.NateS– NateS2017-12-01 20:35:31 +00:00Commented Dec 1, 2017 at 20:35
Just for the sake of completeness, if you need to auto-login to Desktop as root, you can do the following:
- configure the
piuser to autologin usingraspi-config - replace
autologin-user=pitoautologin-user=rootin/etc/lightdm/lightdm.conf - reboot
Steve already warned about the dangers of root login from security standpoint. When logging to Desktop, more issues arise which will affect even basic usability:
- PulseAudio will run in system mode, which is slower and has less features (that is, in addition to being less secure)
- Many software packages will refuse to run as
root(at least without hacks), or will be missing essential features:chromium,tor,and,xscreensaverand many more. Example:
graphical file managers will become really dangerous: a single misclick can e.g. drag&drop your
/etcinside/lib, completely ruining your system.since
rootprocesses are considered more valuable by OOM killer, opening a huge file in GIMP or a buggy webpage in your browser is likely to kill a few innocent processes along the way.
So, even if you don't care about security, you should consider whether saving those 10 seconds to type in sudo is worth all the time you will lose fixing misbehaving software and risking a reboot after each browser crash.
- I get really tired of this root paranoia, I've been logging in as root for 20 years. Not that I never made a mistake but I didn't do it twice, and I had to fix what I broke or reinstall.Alan Corey– Alan Corey2018-04-10 15:59:31 +00:00Commented Apr 10, 2018 at 15:59
- 1I wouldn't have my mother do it, or most undergrads. Having your processes run with elevated privileges is maybe the worst part.Alan Corey– Alan Corey2018-04-10 16:14:39 +00:00Commented Apr 10, 2018 at 16:14

