LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-29-2023, 11:13 AM   #1
will41
Member
 
Registered: Jul 2020
Posts: 76

Rep: Reputation: Disabled
sudo vs admin


When I first installed Fedora 38 I had one account with admin privileges. With this arrangement, some actions in the gui require admin authentication by entering the admin password. Some commands on the command line require the use of sudo. Is this a safe way to work, including internet access, or should I change this account to a standard account and set up a separate account for admin purposes?
Trying to answer my own question, I have experimented by doing the latter and find that the admin account appears to not require the use of sudo. And a standard account without admin privileges can't use sudo or authenticate certain actions in the gui. I'm assuming the latter is best.
If the latter is best, how then does the user without admin privileges do something that requires sudo or authentication like installing software or other administrative function in their account?
 
Old 06-29-2023, 11:27 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,359
Blog Entries: 3

Rep: Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767
sudo is not an all-or-nothing proposition. You can add the various abilities a la carte without giving away the whole shop. First enumerate the actions you which the helper account to be able to carry out, then adjust /etc/sudoers or /etc/sudoers.d/ accordingly.
 
Old 06-29-2023, 11:33 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
Some people here recommend having two user accounts, only one of which has sudo privileges. You use the other one for online work such as surfing the web. That way, if the account is compromised, the cracker can't escalate by getting sudo access.
 
1 members found this post helpful.
Old 06-29-2023, 12:06 PM   #4
will41
Member
 
Registered: Jul 2020
Posts: 76

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hazel View Post
Some people here recommend having two user accounts, only one of which has sudo privileges. You use the other one for online work such as surfing the web. That way, if the account is compromised, the cracker can't escalate by getting sudo access.
BTW, These questions are relative to a single user laptop. I'm not trying to administrate for multiple users.

Thanks. I think this is what I'm leaning toward. Two questions:
Why, if admin gives the standard account admin privileges, does he have to use sudo for some admin commands or authenticate some gui actions?
Does the standard account have any limitation on what he can do within his account; stuff that only admin can do?

Last edited by will41; 07-12-2023 at 01:12 PM.
 
Old 06-29-2023, 12:30 PM   #5
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,521

Rep: Reputation: Disabled
The 'root' user decides who can run which programs, by adjusting the sudoers file, you could limit them to only logging off, or they could be allowed to halt the whole system, it can get complicated, that is why OpenBSD introduced 'doas', it replaces the complexity of sudo with an easier to understand syntax.

(Sometimes I just have a user account & a root account, most of the time I have sudo.)
 
Old 06-29-2023, 12:31 PM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
I think the admin thing is part of polkit, which is a gui enabling kit. Some polkit users can be defined as administrators, which means their passwords have special power. Sudo is more basic and designed to work on the command line.

Last edited by hazel; 06-29-2023 at 12:33 PM.
 
Old 06-30-2023, 09:22 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
@hazel: Of course, "I am one of those people" who strongly advocate for very tight control of "admin access," which in the Unix/Linux environment consists of "membership in the wheel group."

A member of this group has unlimited access to the system, including the ability to issue the command sudo su, which immediately grants this user "root privileges" using his own password.

I can count on one hand the number of clients that I have worked with who actually took the time to "edit the sudoers file." 99.7% of them were simply lazy.

Every operating system possesses some variation of achieving this fundamental distinction between users. What's "lately very remarkable to me," however, is that it typically becomes the default. Typical installation scripts invite the user to set up one user account, not two.

The "fly in this ointment" is that, in these days and times, far too many "evil outsiders" can engineer a way to "exercise 'your' privileges without your knowledge," i-f you have them. This leads to the vital "principle of least privilege."

Even when you are "administering a very large system," and whether you are doing it on Linux or Windows or [anything-else], you can still exercise this principle. (After all ... are you ever so careless with the keys to your car?)

Last edited by sundialsvcs; 06-30-2023 at 09:26 PM.
 
Old 06-30-2023, 09:37 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
Always remember that Unix® began as a timesharing operating system – built to constrain very-smart college students. Almost all users simply concerned themselves with whatever they had in their "home" accounts. The power to do anything else was purposely placed beyond their reach ... which of course caused it to be irresistible. (koff, koff ...)
 
Old 06-30-2023, 10:55 PM   #9
will41
Member
 
Registered: Jul 2020
Posts: 76

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
@hazel: Of course, "I am one of those people" who strongly advocate for very tight control of "admin access," which in the Unix/Linux environment consists of "membership in the wheel group."

A member of this group has unlimited access to the system, including the ability to issue the command sudo su, which immediately grants this user "root privileges" using his own password.

I can count on one hand the number of clients that I have worked with who actually took the time to "edit the sudoers file." 99.7% of them were simply lazy.

Every operating system possesses some variation of achieving this fundamental distinction between users. What's "lately very remarkable to me," however, is that it typically becomes the default. Typical installation scripts invite the user to set up one user account, not two.

The "fly in this ointment" is that, in these days and times, far too many "evil outsiders" can engineer a way to "exercise 'your' privileges without your knowledge," i-f you have them. This leads to the vital "principle of least privilege."

Even when you are "administering a very large system," and whether you are doing it on Linux or Windows or [anything-else], you can still exercise this principle. (After all ... are you ever so careless with the keys to your car?)
I think I mentioned above that I recently changed my system so that I now have an admin account and a user account. Earlier today, I absently mindedly tried to update the system as user. Of course, it said that user is not on the sudoers list (or something like that). If I understand that I can put my user name on that list and then get su privileges with my user password, I don't like that. That's crazy. When working as user, is there a way to get temporary admin privileges or do you just have to switch users by temporarily logging out. It would seem logical to give the command sudo su and then use admin password, but that doesn't work.
Ah ha. I found it: su username then username's password. Never mind, but thanks.

Last edited by will41; 06-30-2023 at 10:56 PM.
 
Old 07-01-2023, 03:24 AM   #10
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,573

Rep: Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499
Quote:
Why, if admin gives the standard account admin privileges, does he have to use sudo for some admin commands or authenticate some gui actions?
I don't use Fedora but I believe it (like Ubuntu and its derivatives) use sudo by default so that the primary user created during the install has sudo (root) privileges. This requires the use of sudo with the password of the primary user to make system changes.

Quote:
Does the standard account have any limitation on what he can do within his account; stuff that only admin can do?
Yes. When logged in as the primary user, that user is as limited as any other user unless using sudo with the password. I'm not sure what you mean by 'admin' account. If this is the primary user created during install, the privileges are the same as any normal user without using sudo.

The link below leads to a page which explains sudo to some degree and its advantages.

https://www.beyondtrust.com/blog/ent...hould-you-sudo

As pointed out above, you can also give a normal user rights to run some commands requiring sudo to run a specific program or programs or to perform specific system tasks.
 
Old 07-01-2023, 01:17 PM   #11
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
Simply allow the usual installation sequence to create the (one ...) administrator account. Then, log on as that account and create your everyday user account(s).

Since I run several small businesses, I create individual user-accounts for "each 'hat'" that I need to wear from day to day. Including accounts which represent the computing situation of each client, and an "accountant" user-id, and so on. All of these are "non-privileged." And, their /home/xxx directories are walled-off from each other.

When I log in to any of them, I am immediately presented with the "familiar environment" that I need for each "hat." But any "online robotic intruder," trying to exercise the privileges of the user or trying to gain more, would go nowhere. Each user has everything that it needs to perform its appointed role, and nothing(!) more.

Last edited by sundialsvcs; 07-01-2023 at 01:20 PM.
 
1 members found this post helpful.
Old 07-02-2023, 08:29 AM   #12
will41
Member
 
Registered: Jul 2020
Posts: 76

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
Simply allow the usual installation sequence to create the (one ...) administrator account. Then, log on as that account and create your everyday user account(s).

Since I run several small businesses, I create individual user-accounts for "each 'hat'" that I need to wear from day to day. Including accounts which represent the computing situation of each client, and an "accountant" user-id, and so on. All of these are "non-privileged." And, their /home/xxx directories are walled-off from each other.

When I log in to any of them, I am immediately presented with the "familiar environment" that I need for each "hat." But any "online robotic intruder," trying to exercise the privileges of the user or trying to gain more, would go nowhere. Each user has everything that it needs to perform its appointed role, and nothing(!) more.
I understand and that is what I have done except I need only one "user" account. However, I do find it curious that even when logged in as "admin" with, I assumed, full privileges, "admin" still has to use "sudo" to do some things like updating the system.
I know. I need to dig deeper into information about privileges.

Last edited by will41; 07-02-2023 at 08:30 AM.
 
Old 07-02-2023, 09:32 AM   #13
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
As a member of the wheel group, an "administrator" has the ability to use su without restriction, including the ability to issue "sudo su" to gain root-level access using its own login password. This is why such capability should be very tightly restricted.

"Rogue software" runs as "you" and is able to do what "you" can do, but without your knowledge nor consent. This is why you should voluntarily place limits upon yourself. Computers are terrible at knowing when to say "yes," but terrific at saying "no."
 
Old 07-02-2023, 02:12 PM   #14
will41
Member
 
Registered: Jul 2020
Posts: 76

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
"Rogue software" runs as "you" and is able to do what "you" can do, but without your knowledge nor consent. This is why you should voluntarily place limits upon yourself. Computers are terrible at knowing when to say "yes," but terrific at saying "no."
Hopefully, that is what I have done. Thanks.
 
Old 07-03-2023, 12:58 AM   #15
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,041

Rep: Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348
sudo and su must not be used together at all. It was discussed several times also here, at LQ.
Additionally you need to know there is no general admin user (like god with "full privileges"). It is always meant to be: admin of <something>. Root is the admin of your OS and additionally you may have another admin for your database, or for your web services or anything else. Usually root has no any (or just minimal) right to access these services/apps.
 
  


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
sys admin vs network admin sulekha Linux - General 5 01-11-2009 05:03 AM
2K admin now RHEL4 admin (I have some questions) wilsryan Red Hat 5 01-30-2006 12:18 PM
User admin and N/w admin on Gnome hangs ssrini *BSD 2 07-28-2005 07:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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