LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-19-2024, 02:41 PM   #1
CodeGourmet
LQ Newbie
 
Registered: Apr 2024
Posts: 1

Rep: Reputation: 0
Question Sudo


As a beginner any tips on using sudo to get to grips with the command e.g. for improved security?
 
Old 04-19-2024, 03:03 PM   #2
blunix2
LQ Newbie
 
Registered: Apr 2024
Posts: 12

Rep: Reputation: 1
What exactly are you trying to achieve?

Just be more secure? Are you talking about your workstation or administrating servers?
 
Old 04-19-2024, 09:11 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,332
Blog Entries: 28

Rep: Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144Reputation: 6144
The sudo command was originally not created to be a proxy for root (despite the *buntus and their creepy sudo fetish). Rather, it was developed to give selected and limited privileges to select users who needed them to perform their duties.

Some examples:
  • Web administrators who might need to restart apache but have no need to, update a system or add or remove users.
  • Someone in a personnel department who needs to add new users, but is not authorized to install and remove software.
  • IT personel who might need to login under other users' credentials to troubleshoot a problem, but don't need root privileges.
You might find this article on the history of sudo helpful.
 
2 members found this post helpful.
Old 04-20-2024, 07:55 AM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,528

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
Agree with post 3. Using sudo to give additional users the ability to run a specific command or a limited number of commands is useful. The Ubuntu site at the link below lists the advantages/disadvantages of using sudo. Look at the first few advantages which are pretty minor. Most of them are just for the user to put in less effort.

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

Last edited by yancek; 04-20-2024 at 08:06 AM.
 
Old 04-20-2024, 10:55 AM   #5
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,142

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
And here's a comment from the anti-sudo brigade!
PCLinuxOS
Personally, I suspect that it doesn't matter that much on a home computer and I've also taken the view that it's best to let distros work as their developers want them to.
 
Old 04-22-2024, 11:41 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Agree with Post #3.

Also, using su as a general admin means any hacker would have to guess your user+passwd just to get in, then guess again for root passwd.
OFC you don't have remote access to root - right ! ?

Local security is a whole other conversation...
 
Old 04-23-2024, 12:23 AM   #7
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,321
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
Quote:
Originally Posted by CodeGourmet View Post
As a beginner any tips on using sudo to get to grips with the command e.g. for improved security?
I'd also second post #3.

The sudo utility is nowadays usually misunderstood, misconfigured, and abused, often through intentionally wrong settings. Ubuntu got those misunderstandings established as a common practice.

Since topic keeps coming up, I keep having to recommend Michael W Lucas' book, sudo Mastery, to learn the real capabilities of sudo as a tool for providing granular access. You local or regional technical college should have it on the shelf, if not they can order it for you. Either way, you can hunt down the video of his talk, "sudo: You're Doing It Wrong", to get a rather quick overview.
 
Old 04-30-2024, 02:31 AM   #9
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,321
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
Quote:
Originally Posted by ___ View Post
FYI news: run0 is systemd's sudo replacement:
I thought you were joking, but Bobby Borisov over at Linuxiac has an article about systemd's run0, albeit one oozing with sarcasm.

Poettering starts stuff but he and his team appear to never delve deeply enough into any given task to master it. The result is a messy trail with a wake of half-baked, poorly though out, partially implemented 'replacements' littering the distro scene. Sadly those 'replacements' get pounded down our throats through internal politics in Debian and Fedora, the two stems from which the tree of distros grow.

There is already a solid replacement for sudo called doas. It developed in OpenBSD, but has been ported to many distros.

But we haven't heard back from the OP who last posted in this thread some weeks ago. CodeGourmet, what questions remain about sudo after having read post #3 and the other posts?
 
1 members found this post helpful.
Old 04-30-2024, 02:32 AM   #10
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,157

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Agree with post #3.

I asked Google Gemini it says:
Quote:
Sudo stands for "superuser do". In the world of Linux and related operating systems, it's a command that lets you run programs with the privileges of another user, typically the administrator account known as "root".
Quote:
As a beginner any tips on using sudo to get to grips with the command e.g. for improved security?
Depends on your environment, if it's a company setting give sudo access to what the user needs.
Of course, it's better to ask the user like the following questions, before granting the access.

- Why you need the sudo access?
- What is the command that you required?
- How often do you use or access the command?

Then if the user cannot justify, then you decide whether to give them sudo access or not.

check this YT, might give you more ideas: https://www.youtube.com/watch?v=yy3CRLTDLQE

Good luck!
 
Old 04-30-2024, 03:37 AM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,897

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
yes, it is a good overview: "sudo: You're Doing It Wrong"
Anyway, I don't think run0 is a really good replacement, it raises more questions than it answers. And I believe run0 will me misused even more (if sudo will be replaced).
 
Old 04-30-2024, 05:40 AM   #12
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,597
Blog Entries: 19

Rep: Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455
Quote:
Originally Posted by Turbocapitalist View Post
I thought you were joking, but Bobby Borisov over at Linuxiac has an article about systemd's run0, albeit one oozing with sarcasm.
But that's just polkit with knobs on. In polkit, you already have a daemon which performs privileged actions for you after an agent has authenticated you. And I've noticed that polkit config files use the same Windows-like syntax as systemd files. All these things come out of the same stable.
 
Old 05-01-2024, 10:30 PM   #13
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
i try to stay away from sudo at all cost

it dose have its place in a multi-user environment and is good for giving other users SOME root privileges

but on a single user desktop -- a BIG NO

having a real "root" user account is rather handy in fixing a busted update to the system
 
Old Yesterday, 12:20 AM   #14
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,658

Rep: Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708
I rather disagree with John VV, it can be a useful tool for a single user system.

It depends upon your system, the distribution, and how you have it configured.

For the first 10 years of my IT career SUDO did not exist, and I did not run into it until 2002.

Doing needless damage and generating complaints because of misuse of ROOT account caused some developers to restrict the root account so that you needed SUDO to complete procedures that required SU access. I am not sure that was wise, but I can see the logic. Alas, they replaced ROOT account misuse with SUDO misuse!

Always consider carefully what you want to do that requires root authority, and how to provide the MINIMUM elevated access to accomplish the desired result.
 
Old Yesterday, 01:59 AM   #15
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,897

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
Quote:
Originally Posted by wpeckham View Post
I rather disagree with John VV, it can be a useful tool for a single user system.

It depends upon your system, the distribution, and how you have it configured.

For the first 10 years of my IT career SUDO did not exist, and I did not run into it until 2002.

Doing needless damage and generating complaints because of misuse of ROOT account caused some developers to restrict the root account so that you needed SUDO to complete procedures that required SU access. I am not sure that was wise, but I can see the logic. Alas, they replaced ROOT account misuse with SUDO misuse!

Always consider carefully what you want to do that requires root authority, and how to provide the MINIMUM elevated access to accomplish the desired result.
I developed a sudo like tool (at about 1997/98), it had a nice additional feature, a time limit. It was used to run something as another user, not as root.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The Differences between Su, Sudo Su, Sudo -s and Sudo -i LXer Syndicated Linux News 0 09-15-2022 07:47 PM
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
sudo sudo onthefritz SUSE / openSUSE 4 06-05-2007 02:37 PM
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM
Sudo without having to type "sudo?" Mitch G Linux - Security 3 09-28-2006 02:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:36 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