I wonder if it comes from having a windows mindset and the way windows screams at you about unauthorized software and forces you to use an administrator password for random arbitrary things while saying it's for your protection. With windows background as a single user operating system, heavily targetted by malware this makes sense.
Then they come onto linux, find out they need to use sudo to install things from package managers or access files in the root directory and immediately that protecting themselves mindset comes into play. However, taking into account Linux's background as a multi-user operating system, this mindset makes less sense as the tools while working similarly at a shallow level, were designed for totally.different purposes.
random arbitrary things
From what I can see that's not the case at all. In fact for me it seems rather sudo-y. Want to change system files? Need sudo / UAC. Want to install software (which is basically like the first case)? Need sudo / UAC? Want to screw up your home directory? No need for sudo, no UAC.
Additionally, a lot of registry settings are things that should be user settings. Want to remap caps to escape? That would normally be a per-user window manager setting on Unix, but on Windows you have to use the Registry Editor.
Most of the other "normal" Setting/Control Panel changes that need UAC prompts for certain classes of users have similar explanations. What Windows considers a system-level or multi-user setting certainly differs than *nix, but it doesn't necessarily mean there isn't a good reason why it differs.
Some of that is that Windows (NT branch, XP+) is a multi-user operating system most widely deployed by people that assume it is a single-user operating system and exacerbated by confusion where Windows mostly pretends to be compatible with a single-user operating system legacy (3.x/95-ME) right up until it cannot anymore and sometimes the multi-user-ness comes out to bite.
registry settings are things that should be user settings
User settings are most of the time registry settings since that thing is used where other OS use plain files :) But I know what you mean, some of the choices which were once made are strange and because of the sometimes annoying "let's keep things backwards compatible forever" principle it's also not likely to change soon. Then again, pretty sure for remapping there are workarounds in the form of creating your own keyboard layout for which MS has tools. Now if changing a keyboard layout still requires a UAC prompt (I really hope it doesn't) you're still nowhere.
Also, the normal UAC setup for a consumer device does not require a password, just pressing a button.
As a novice Linux user, that was exactly my mindset and reasoning.
That's not really true. An unprivileged user shouldn't be able to take down a production system, or really adversely effect other users. Assuming you have disk quotas enabled, what else could an unprivileged user do?
Why do these people have shell access to production systems in the first place?
I have access to this box and it has granted me access to some other system which has useful data, like a database, NFS mount, or S3 bucket. Let me hop in here and grep for something juicy to steal, maybe flip some bits around to fuck with people, or just delete shit.
You can't steal data unless if you intentionally delete the original after copying, but then that is not really theft as any proper organisation will have backups.
"Theft" is a nice easy word for making a copy of data that you do not have permission to access.
How about deleting everything under /var/www/?
> >Plus, there's still a lot of damage you can do without root access.
> That's not really true. An unprivileged user
We can see that "unprivileged user" equals to anything that is not root in your post. Considering that definition www-data is an unprivileged user which can delete everything under /var/www/.
So no, what you are saying is not really true.
Obviously a user can modify their own files. The idea is if you compromise unprivileged user "scott", with their account, you can't harm other users or the system itself.
[1]easily. Technically it depends, but a hardened configuration would only give www-data permissions to read files its data files in /var/www, not write them (which includes delete), apart from things it actually needs to write like its app logs (and even then you should be using syslog facilities, which only let you write, again not delete or cause any issues). Principal of least privilege and all that. For fun, try to figure out how to ssh into your system as www-data and see the half dozen different roadblocks that come up in your way.
>only running `sudo service` so they can log in an restart a service, but not make any other changes
So you think too, its a security measure?
For example, a short fence can be considered a security measure, though it can be purposefully stepped over. Maybe it only serves as a guide, or maybe it protects a window from a nearby soccer field.
In that same way, the sudo example you're deriding can provide the 'security' of making the proper workflows more visible to the user- without being designed to keep out a malicious professional hacker.
What makes you think that?
I don't think it's useful in protecting against people with the intent to break stuff. A malicious person doesn't necessarily need root to do damage, and if they do, then there are many vectors for obtaining elevated privileges from within a shell.
I do think that it's useful for keeping users from within your organization from doing damage by accident. Like, you could enabled a person to log in and restart a service, but prevent them from mucking around with configurations.
They don't stop people from intentionally doing it.
PS: And the cold sweat after typing something like 'rm -rfd /' is still the best training-well
Rider: Lean to the side
Training wheels: Hey! Whoah there. If you do that you will fall.
Rider: I know, do it anyway! (sudo...)
Training wheels: Your choice, I can only prevent so much.
Rider falls over...
If a user has sudoer privileges, sudo serves as nothing more than training wheels.
User: apt install APP
System: Access denied. sudo privileges required
User: sudo apt install APP
Sytem: Okie doke
And the age old `sudo make me a sandwhich` joke continues...
`sudo X` => `super-user-do X` => `I really mean to do X`
For a user that has privileges to run a command, `sudo` is equivalent to Windows popping up the "Admin Privileges Required: OK? Yes. Done" prompt to run an app when you are already an admin.
If you are already an admin (or sudoer in the Unix world), why ask? Because the command you are running is potentially destructive and you want to double check? That's fine, but it is just like training wheels.
If a user is not a sudoer, the topic is entirely irrelevant, and if sudoers do not have permission to run certain commands that is a completely different question.
But to answer the original question, "Is Sudo Almost Useless?", the answer in most cases is yes.
For that you could just do
alias sudo=su -c
if you want the admin (root) password to be different from the user (authorized users) password.I suppose the main advantage of sudo is it gives you more granular control over which commands are allowed and which aren't. For example if you're building a robot, you can allow the robot's process access to /sbin/shutdown to be able to restart the system on remote command (or lack of remote command).
This will not work. sudo cp aaa bbb will work but su -c cp aaa bbb will complain that the user aaa does not exist, you need to quote them instead, like su -c "cp aaa bbb".
It would make more sense to make it a script
#!/bin/sh
su -c "$@" ~ :) gudo () { su -c "$@"; }
~ :) gudo echo foo bar
su: user foo does not exist pi ALL=(ALL) NOPASSWD: ALL
(I must go check my reports... "This incident will be reported.")
I thought the general strategy was to not give daemon accounts shell access at all. Getting shell access is the hard part for a malicious actor. Once you have shell, root access is just a matter of finding a piece of unpatched software with a privilege escalation exploit out there. Plus, there's still a lot of damage you can do without root access.