why would a general-purpose distro not add users to sudoers file?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
OPTIONS
-c, --command=command
Pass command to the shell with the -c option.
... Looks pretty easy to me.
TIL, I always thought su was for switching user to root or another account. In any case, isntructions never suggest "su -c" to do stuff, that I've ever seen, in my few years using linux based os's.
Actual administrative tasks rarely involve just a single command. Even something as simple as "apt-get update; apt-get upgrade" is two commands. It's better to just get in the habit of su - to root, so you do everything as root and then get out, rather than have a confusing mixed terminal state where some commands are being run as a normal user and some are being run as root.
*WHY* is that "better"? It just seems more dangerous to me. When you have to type sudo every time you do a command that requires root, you're well aware it requires root.
Actual administrative tasks rarely involve just a single command. Even something as simple as "apt-get update; apt-get upgrade" is two commands. It's better to just get in the habit of su - to root, so you do everything as root and then get out, rather than have a confusing mixed terminal state where some commands are being run as a normal user and some are being run as root.
That's just opinion anyway. Nothing there about being more secure. You're suggesting somehow it's easier to remember to exit when you're done, I think its better to have to remember to use sudo every time, but neither of that makes it better or worse. The only thing I think that makes it worse is that root account has a password at all, making it possible to login as root.
I disagree. sudo is quite useful for single user systems, where the primary user is the admin. In my mind, that is the main use case in fact.
That was your response to a comment about sudo on multiuser systems. So the statement "because your FORD broke down your Chevy sucks" would make perfect sense to you? The original point was valid. Your point is also somewhat valid. The two are not in conflict.
How so? How is using sudo more prone to mistakes than su? Sudo is less error prone cuz it only effects the one command... people using su actually switch to the root user until they remember to exit... one cannot use su for a single command easily...
I did not say one is more prone to mistakes than the other. Doing ANYTHING using root authority that can be done without it entails additional risk and bypasses authority level protections. Sudo, however, does better logging and can be use to execute commands with authorities other than your own and root making it the superior tool.
Using sudo at least logs the command-line you executed to you can find your error later (assuming the logs survive). Using sudo is no protection, even of a trail or log, if you use sudo to run su and then execute multiple commands: yet that is the way most Ubuntu users will use it.
Most of the documents I see that use sudo commands execute a single command per sudo evocation. That is also the way I use it in my documentation, and what I recommend. Used that way every command is logged, and you can refer to the log for history when troubleshooting issues later.
If you want to, do. But if you wonder why you should not, losing your data and having to reload your system will teach you.
*WHY* is that "better"? It just seems more dangerous to me. When you have to type sudo every time you do a command that requires root, you're well aware it requires root.
It's better because it is easier to mentally keep track of being in a "root mode" where you have to be careful and then to complete the task and then leave the "root mode". During this time, you only need to keep in mind the root's environment and capabilities. There's no possibility of accidentally, say, creating a directory with the wrong owner/permissions.
With a mixed mode you have to have two different environments and capabilities in mind at all times. Because of this mismatch, you could accidentally create a system file that's owned by the normal user (oops, security hole!), you could accidentally create or move a file in the wrong location, and so on.
Conversely, you have yet to explain why "it just seems more dangerous". Why is it more dangerous?
By switching to a root login from a normal user, you limit vulnerability to the time you're logged in as root.
With sudo, you're vulnerable the whole time you're logged in as a user that can sudo to root.
It might well be said that "disabling root" was intended to deny "ssh bots" a "known user-id" that they knew they could attack. (For those people who are stupid enough to directly expose "sshd" to the outside world – of which there are a great many.)
Last edited by sundialsvcs; 12-18-2023 at 08:43 AM.
It might well be said that "disabling root" was intended to deny "ssh bots" a "known user-id" that they knew they could attack. (For those people who are stupid enough to directly expose "sshd" to the outside world – of which there are a great many.)
This seems a silly idea, considering how easy it is to either disable root ssh and/or require key based authentication (the key, of course, can be also password protected).
Exposing sshd is not really a problem, but of course it's worth familiarizing yourself with the appropriate sshd configuration options for your situation.
I think that for the vast majority of people who need sshd installed, disabling root ssh and requiring pass protected key based authentication for the allowed (normal) user should be good.
But the default for a single user desktop workstation should be to not install sshd at all. Nor should sudo be installed by default. Boom! Problem solved for 99% of users. Absolutely silly to use this idea as a justification for Ubuntu's sudo abuse.
The site below has been around for many years referencing the advantages and disadvantages of using sudo and appears to be outdated based on the caveat at the top of the page which is almost 4 years old.
It seems to me that number 8 under advantages was/is the purpose of sudo, originally at least. Most of the other advantages aren't significant and from what I have read from users of distributions using sudo, many users are looking for easy ways (no password login, no password to install software, no password to write to system files, et..) and have little concern for security but are more focused on ease of use. Not a good thing with the internet of today.
Well, I learned enough in this thread, such as the fact that sudo was popularized by the Ubuntu pushers...or, if it was already popular, the Ubuntu pushers over-popularized it.
Last edited by newbiesforever; 12-27-2023 at 12:20 PM.
Exposing sshd is not really a problem, but of course it's worth familiarizing yourself with the appropriate sshd configuration options for your situation.
I think that for the vast majority of people who need sshd installed, disabling root ssh and requiring pass protected key based authentication for the allowed (normal) user should be good.
How many people out there are going to configure 'sshd' "safely?" The thing will ratchet down to the least secure option that it is permitted to accept. And, even so, it's exposing a well-known open port to any "bot" that drifts by. Within days of your new system appearing on the internet, it will be incessantly "hammered."
As I've said here many times before, use openvpn with unique digital certificates and tls-auth as your "moat with a hidden(!) drawbridge," then use 'sshd' as the portcullis. "Number of unauthorized access attempts: Zero."
Sudo was around before Canonical, but for Ubuntu they used it in an unintended fashion.
Actually they didn't invent that idea. Knoppix was using universal sudo before Ubuntu existed. Admittedly Knoppix was a live distro often used as a rescue image. Ubuntu probably was the first distro to do that in an installed system.
How many people out there are going to configure 'sshd' "safely?"
Perhaps I am expecting too much out of these people, but I do expect that only a fraction of people will even need to install sshd and that this fraction of people will either:
1) Know what the heck they're doing
or
2) Be following some sort of tutorial, and this tutorial will explain how to configure sshd
Quote:
Within days of your new system appearing on the internet, it will be incessantly "hammered."
But does it matter if it is "hammered" if there's no chance of it being compromised?
As for the system "appearing on the internet", this will only happen if the ssh server in question is connected to the internet in such a way that it "appears" to the outside internet. That's not going to just happen at random. The vast majority of users connect to the internet via some sort of internet service provider, and the hardware provided by this ISP does NOT expose the user's computers to incoming requests by default.
So again ... the only way for this computer to "appear" to the outside internet is:
1) The user knows what they're doing
or
2) The user is following some sort of tutorial to expose this port to the outside internet
Both of these steps are significant hurdles to overcome for a random person who doesn't already have a good idea what they're doing and why.
So perhaps I'm expecting too much out of people who are determined to work through those hurdles, but I just feel like those people will manage.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.