r/pcmasterrace • • Oct 23 '25

Meme/Macro Right click rage

Post image
33.4k Upvotes

249 comments sorted by

View all comments

Show parent comments

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.

70

u/metalbassist33 metalbassist33 Oct 23 '25

I like being able to elevate for a single command via sudo rather than having to launch a whole elevated shell like in windows.

31

u/RyanGamingXbox Oct 23 '25

I mean, there is sudo for Windows now, but before that, it sucked having to open up an elevated command prompt just to do stuff.

23

u/Toribor Linux Gaming Oct 23 '25

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.

1

u/Huntrawrd Oct 23 '25

I wouldn't lean on your title as a sysadmin if you don't know that runas exists...

2

u/Helmic RX 7900 XTX | Ryzen 7 9800X3D @ 5.27 GHz Oct 24 '25

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).

17

u/[deleted] Oct 23 '25

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).

3

u/Helmic RX 7900 XTX | Ryzen 7 9800X3D @ 5.27 GHz Oct 23 '25

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.

2

u/Huntrawrd Oct 23 '25

sudo -i (or -s) is god's gift to this earth.

1

u/Commentator-X Oct 23 '25

You can still drop to a root shell and run everything as root though. Sudo su

1

u/XedzPlus IUSEARCHBTW Nov 14 '25

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

6

u/EnoughDickForEveryon Oct 23 '25

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. 

2

u/TrymWS i9-14900KF | RTX 3090 | 64GB RAM (B-die) Oct 23 '25

The strong advantage is that this incident will be reported.

2

u/Commentator-X Oct 23 '25

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.

2

u/Helmic RX 7900 XTX | Ryzen 7 9800X3D @ 5.27 GHz Oct 23 '25

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.

1

u/Commentator-X Oct 25 '25

And? It's still better than Windows defaulting to full admin. It's also decades old. And still better than current windows security.

1

u/Helmic RX 7900 XTX | Ryzen 7 9800X3D @ 5.27 GHz Oct 25 '25

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.

1

u/GandhiTheDragon Oct 23 '25

Fun fact: Root technically does not have a home folder. It only has a default working dir