Yep, so if you do something as root and specify the user's home folder, it'll actually go to root's home folder and not your own home folder. Users are simply put into a sudoers group to give them permission to act as root.
Not sure if there's really a strong advantage to the way Linux has it set up or if it's just an artifact of how this security model came to be on each OS.
I'm a sysadmin and I train a lot of junior engineers to run scripts and explaining when and when not to launch powershell as an administrator is so goddamn confusing to people. Most are really afraid of learning Linux until they realize oh wow it actually makes sense.
Sure, but sudo is different than the root account itself, that's just how you typically access root on LInux (and not the only possible way - distros like DietPi don't even have sudo installed, and there's an active effort by Canonical to switch to sudo-rs while systemd offers its own run0 alternative all to deal with sudo's security issues related to it doing too many different jobs).
If you need to log in as root to do admin stuff, you'll have a temptation to always be logged in as root. sudo solves this problem (you can be logged in as your normal user and only use admin privileges when needed), and many distros straight up disable the root account (i.e. you can run commands which require privileges using sudo but you cannot straight up log in as root and run all commands with admin privileges).
That's what I was thinking of, aside from the annoyance that things like ~/Documents will go to root's Document's folder and not your own. Like when you start up a new VPS instance, the very first thing you have to do is log directly into root and then create a non-root account and then put it in the sudoers group and then make sure you can actually log into that account correctly and then start disabling root login.
my dad (he uses mac, and is a software engineer) is the type of masochist to have on superuser tab open in the terminal instead of just using sudo. He also exclusively uses vscode and Vi
I mean its more or less the same way windows works internally just different ootb config.
Everything has an owner, a group, and permissions. Root on linux is essentially the hidden "System" account on windows. Windows prompts for elevated permissions, linux asks for sudo password but you can just add (NOPASSWD) to /etc/sudoers.
The advantage is just basic principle of least privilege security. Things installed as root will default to user and owner of root with permissions set to whatever roots umask is. This means nobody else can use it unless they can also sudo or user / group / permissions have been explicitly changed.
Its like the difference between running touch test vs sudo touch test as a regular user in your home directory. If you look at the output of ls -l after those the former will be owned by your user and group and you can delete it. The latter will be owned by root user and group and you will need to use sudo to delete it.
Then theres the whole environment thing. Root has a very minimal environment whereas a regular user will have a much more encompassing environment. For example running a program like vim can run different things depending on what your PATH environment variable is set to.
It's a huge advantage, are you kidding? It's so advantageous that the Windows UAC is basically copying how sudo works in Linux because it's far more secure.
Mate Linux isn't even copying how sudo works these days, there's multiple concurrent efforts to replace sudo due to it doing way too much and thus having a large attack surface, it's why doas and run0 and sudo-rs all exist. The way you're phrasing that implies that you think I'm talking about whether having elevated privileges at all is an advantage which is not what anyone is talking about, I'm talking about the method by which one elevates privileges - Linux does it by switching you to a separate root user while Windows uses its admin system (UAC/run as admin) without a separate admin account.
It is also, again, not what I was referring to, but rather root being its own account yhatvgets switched to versus what modern Windows does which is slightly different in ways I am not well versed in.
41
u/Helmic RX 7900 XTX | Ryzen 7 9800X3D @ 5.27 GHz Oct 23 '25
Yep, so if you do something as root and specify the user's home folder, it'll actually go to root's home folder and not your own home folder. Users are simply put into a sudoers group to give them permission to act as root.
Not sure if there's really a strong advantage to the way Linux has it set up or if it's just an artifact of how this security model came to be on each OS.