Linux root login FAQ

why would I want to log in as root?

minor convenience of not having to type sudo, or remember which commands need it. also the satisfaction of knowing that your operating system will do whatever you tell it to.

how do I log in as root?

assuming you're running Linux, sudo passwd root should let you set a root password on most distros. on a TTY you can now log into the root account using that password.

if you use a graphical display manager (which you probably do if you don't know), it may require additional steps. if you're using GDM (the gnome one, default on many distros including Ubuntu), you have to edit /etc/pam.d/gdm-password. comment out the line that looks like auth required pam_succeed_if.so user != root quiet by putting a # in front of it. you then have to click the little Not listed? and enter root before entering the password. (this is because AccountService classifies root as non-human)

if you're using a different display manager, you'll have to figure it out yourself.

disabling your display manager, booting into a TTY, logging in as root there and running startx/<your wayland compositor of choice> is also an option.

what if I'm on Window's/Mac

apparently you can log in as root on Mac, I'm not sure about Windows.

where do I put my files?

/root (root's default home directory). it's not /home/root for an array of questionable and historical reasons.

will I accidentally delete all of my system files?

probably not.

you do, after all, have the ability to permanently delete all your personal files with one typo every time you open a terminal. a bug in any of your apps can do the same thing. generally speaking, this isn't really a problem though. I have no idea why people think accidental deletion is a significant issue, but only when you have root access.

luckily even if you do delete /bin or whatever you can always boot from a recovery partition or USB device and repair the system with downloaded packages. the same can not be said for the data in your home directory. on a normal Linux system (unless you've set up backups/sync) the only files you can delete are the ones that are irreplaceable.

does root login "break the Linux security model"?

the Linux security model: XKCD 1200

malware can also edit your .bashrc to gain persistence without root, and if you use sudo, it can break into root fairly easily. logging in as root changes very little from a security perspective.

it's possible to build a security model on top of desktop Linux, but none are mainstream for normal users yet. my UID-based approach can be used today, and is fully compatible with logging in as root.

what does the community think?

everyone says it's a terrible idea. that's how you know it has alpha.

why does everyone say it's a terrible idea?

I'm not entirely sure. probably a combination of cargo culting, the thrill of getting to tell someone off and attempting to carry over intuitions from server/institutional/mainframe computing that never applied to personal computers.

will everything work?

unfortunately, some programs have issues when run as root.

notably Chrome and Electron apps (which are Chrome-based) require the --no-sandbox flag. this might be acceptable for trusted Electron apps, but is probably a bad idea for Chrome. run Chrome from another user or use Firefox, which works fine.

VLC also doesn't work by default for stupid reasons, but there's a fix for that and it's very funny. (if you're on Arch you can set it to run automatically on upgrade using a pacman hook)


adapted from the first half of this twitter thread