LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 12-17-2023, 09:02 PM   #31
enigma9o7
Senior Member
 
Registered: Jul 2018
Location: Silicon Valley
Distribution: Bodhi Linux
Posts: 1,389

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560

Quote:
Originally Posted by rkelsen View Post
Extract from 'man su'
Code:
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.
 
Old 12-17-2023, 09:03 PM   #32
enigma9o7
Senior Member
 
Registered: Jul 2018
Location: Silicon Valley
Distribution: Bodhi Linux
Posts: 1,389

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
Quote:
Originally Posted by IsaacKuo View Post
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.
 
Old 12-17-2023, 09:06 PM   #33
enigma9o7
Senior Member
 
Registered: Jul 2018
Location: Silicon Valley
Distribution: Bodhi Linux
Posts: 1,389

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
Quote:
Originally Posted by IsaacKuo View Post
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.
 
Old 12-17-2023, 09:26 PM   #34
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,714

Rep: Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722
Quote:
Originally Posted by enigma9o7 View Post
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.
 
Old 12-17-2023, 09:31 PM   #35
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,714

Rep: Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722
Quote:
Originally Posted by enigma9o7 View Post
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.

Last edited by wpeckham; 12-17-2023 at 09:37 PM.
 
Old 12-17-2023, 09:59 PM   #36
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,463
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
Quote:
Originally Posted by enigma9o7 View Post
Tell me why I'm wrong or delusional?
sudo passwd
 
Old 12-17-2023, 11:58 PM   #37
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by enigma9o7 View Post
*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.
 
1 members found this post helpful.
Old 12-18-2023, 08:42 AM   #38
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
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.
 
Old 12-18-2023, 08:54 AM   #39
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by sundialsvcs View Post
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.
 
Old 12-18-2023, 12:06 PM   #40
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,547

Rep: Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498
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.

https://help.ubuntu.com/community/RootSudo

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.
 
Old 12-27-2023, 12:19 PM   #41
newbiesforever
Senior Member
 
Registered: Apr 2006
Location: Iowa
Distribution: Debian distro family
Posts: 2,378

Original Poster
Rep: Reputation: Disabled
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.
 
Old 12-27-2023, 06:23 PM   #42
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,714

Rep: Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722Reputation: 2722
Sudo was around before Canonical, but for Ubuntu they used it in an unintended fashion.

Not saying they were wrong, but it is not how I would have done it.
 
Old 12-27-2023, 07:55 PM   #43
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
Quote:
Originally Posted by IsaacKuo View Post
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."
 
Old 12-28-2023, 12:11 AM   #44
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,646
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Quote:
Originally Posted by wpeckham View Post
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.
 
Old 12-28-2023, 06:47 AM   #45
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by sundialsvcs View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] User not in sudoers: How to add user? Permtion Denied for sudoers file esgol Linux - Newbie 3 07-13-2012 07:44 AM
Fedora /etc/sudoers file and sudoers.d directory davejjj Linux - Newbie 2 10-21-2011 06:19 PM
[SOLVED] What is the purpose of lib64? How does it serve it's purpose? BMan8577 Linux - Newbie 2 09-20-2011 01:39 PM
I deleted /etc/sudoers and creates a new file call sudoers but now it doesnt for visu abefroman Linux - Software 1 11-10-2005 05:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration