LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 07-23-2022, 10:58 AM   #1
newbiesforever
Senior Member
 
Registered: Apr 2006
Location: Iowa
Distribution: Debian distro family
Posts: 2,378

Rep: Reputation: Disabled
why do some distros not automatically add a new user to sudoers?


For the last seven-and-a-half years, I have used a Debian-based distro that bothers to automatically add my user account to sudoers on installation; so I have never had to mess with the sudoers file. (Well, it obviously must have added me to sudoers, because I can sudo.) I couldn't easily edit sudoers anyway, because I don't know how to use vi (you know--you're supposed to enter visudo, per that error message that warns you you're not in sudoers; and the actual sudoers file advises against editing it directly).

I'm trying out another Debian-based distro, and have found that the installation did not add me to sudoers and I have to do it myself, or it won't let me sudo. That is a problem because I don't know how to edit sudoers or use vi. I have dealt with this before in the past on certain distros, and I never figured out why they would do it--not automatically put a new user in sudoers. Linux expects a user to sudo, but the user can't sudo if he's not in sudoers. I'm befuddled.

Ehh...well, for the moment I guess I'll solve this by copying over the sudoers file from my other installed distro. I don't have a better idea in the short term.

Well, I did just learn usermod. but my question wasn't how to edit sudoers, it was why I have to add myself to sudoers in the first place.

Last edited by newbiesforever; 07-23-2022 at 11:18 AM.
 
Old 07-23-2022, 11:04 AM   #2
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,718

Rep: Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735
Quote:
Originally Posted by newbiesforever View Post
For the last seven-and-a-half years, I have used a Debian-based distro that bothers to automatically add my user account to sudoers on installation; so I have never had to mess with the sudoers file. (Well, it obviously must have added me to sudoers, because I can sudo.) I couldn't easily edit sudoers anyway, because I don't know how to use vi (you know--you're supposed to enter visudo, per that error message that warns you you're not in sudoers; and the actual sudoers file advises against editing it directly).

I'm trying out another Debian-based distro, and have found that the installation did not add me to sudoers and I have to do it myself, or it won't let me sudo. That is a problem because I don't know how to edit sudoers or use vi. I have dealt with this before in the past on certain distros, and I never figured out why they would do it--not automatically put a new user in sudoers. Linux expects a user to sudo, but the user can't sudo if he's not in sudoers. I'm befuddled.

Ehh...well, for the moment I guess I'll solve this by copying over the sudoers file from my other installed distro. I don't have a better idea in the short term.
1. I presume you set a root password, and can su to root. You can run visudo as root.
2. There should only be ONE user automatically added to the sudo group (sudoers, wheel, staff, it varies between distributions). Additional users SHOULD be more restricted until you decide you trust them with the trigger for your reload-the-computer bomb.
3. Set your EDITOR or SUDO_EDITOR environment variables to point to the editor of your choice and sudo will load that instead of vi.
 
1 members found this post helpful.
Old 07-23-2022, 11:07 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,996

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
It is made by design. Some "distro" think it is a good idea, other think it is not that good. Ask the maintainers about their opinions.
From the other hand you can set the variable EDITOR to your favorite text editor (like nano) and visudo will use that - instead of vi.
 
1 members found this post helpful.
Old 07-23-2022, 11:38 AM   #4
Debian6to11
Member
 
Registered: Jan 2022
Location: Limassol, Cyprus
Distribution: Debian
Posts: 382
Blog Entries: 1

Rep: Reputation: 71
Yes, I use nano. First I set a root password if none, then I add user to sudoers as root and exit. Then it's the sources list.
 
Old 07-23-2022, 11:51 AM   #5
newbiesforever
Senior Member
 
Registered: Apr 2006
Location: Iowa
Distribution: Debian distro family
Posts: 2,378

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by wpeckham View Post
1. I presume you set a root password, and can su to root. You can run visudo as root.
2. There should only be ONE user automatically added to the sudo group (sudoers, wheel, staff, it varies between distributions). Additional users SHOULD be more restricted until you decide you trust them with the trigger for your reload-the-computer bomb.
3. Set your EDITOR or SUDO_EDITOR environment variables to point to the editor of your choice and sudo will load that instead of vi.
Staff? Sudoers? I also wonder why installers don't bother to find out whether the system is expected to be single-user and offer appropriate options. Because on my installations, there always is only one user: me. I am both the user and the administrator, and I'm not going to have these additional users.

The distro I had been using, MX, is the only one I have personally used whose designers appear to have considered this--that their distro might be installed as a single-user system. Which explains why I'm not used to dealing with this issue.
 
Old 07-23-2022, 12:39 PM   #6
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,509

Rep: Reputation: Disabled
Most general distros allow you to be a sudo user when you install them - some even let you run as root, dangerous online.

Originally, the only person to have power over an installation was root, everyone else was just a user - it's not such a bad thing, as it makes you more aware that what you are doing could have consequences.
 
1 members found this post helpful.
Old 07-23-2022, 03:18 PM   #7
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,718

Rep: Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735Reputation: 2735
Quote:
Originally Posted by newbiesforever View Post
Staff? Sudoers? I also wonder why installers don't bother to find out whether the system is expected to be single-user and offer appropriate options. Because on my installations, there always is only one user: me. I am both the user and the administrator, and I'm not going to have these additional users.

The distro I had been using, MX, is the only one I have personally used whose designers appear to have considered this--that their distro might be installed as a single-user system. Which explains why I'm not used to dealing with this issue.
Okay. You did not make that clear at the start, and it would be silly for the distro maintainers to ASSUME that was the case as a default.

As for why there would be differences: A small reason is that different installer software programs do things differently. Even the curses or text version may do it differently than the GUI install. But that is a small thing.
The BIGGER reason is because different distro maintainers have a different focus on security and safety of their distribution. Some who come from a hard core sysadmin or security background are more likely to err on the conservative side rather than build a system vulnerable to disasters they know how to avoid. Some developers who have had systems compromised due to insufficient security in default settings will also then avoid creating a problem. The assumption is that if you are advanced enough to need higher access, and you own the system, you should know how to GET that access, and if you do not they will at least not load the gun you are using to shoot at your foot!

And, seriously, if you know what you are doing this is the 90 second inconvenience that you need fix only one time per install. How important is that to the maintainer?
 
1 members found this post helpful.
Old 07-23-2022, 08:22 PM   #8
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,366
Blog Entries: 28

Rep: Reputation: 6161Reputation: 6161Reputation: 6161Reputation: 6161Reputation: 6161Reputation: 6161Reputation: 6161Reputation: 6161Reputation: 6161Reputation: 6161Reputation: 6161
The short answer is security.

Average user has no need to access administrative functions and, indeed, should not be allowed to. For example, I have friend who runs a medium-sized thin-client network in the enterprise. If all the persons who had access to the system, from secretaries to executives to maintenance workers, were automatically granted administrative rights, the system would go to Hades in a handbasket in a half-second.

The distros that automatically add (usually) the installing user to sudoers seem to think that users are --er--incapable of remembering both a root and a user password. Their excuse, I reckon, is "simplicity." But I have found that simplicity and security are often independent variables.

Remember that sudo (substitute user do) was not created to be a proxy for root, though, thanks to Ubuntu's creepy sudo fetish, it seems to have become on in the eyes of many. Rather, it was created to give users who needed it in the course of their duties access to specific and limited administrative functions, such as, for example, webmasters who might need to restart a website from time to time, but who have no business installing updates. Indeed, having separate root and user levels is one of the features that has historically made *nix OSes more secure than certain other operating system.

Not that I have strong feelings on this matter or anything like that.

Last edited by frankbell; 07-23-2022 at 08:24 PM. Reason: Clarity
 
2 members found this post helpful.
Old 07-24-2022, 07:37 PM   #9
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,687
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by frankbell View Post
The distros that automatically add (usually) the installing user to sudoers seem to think that users are --er--incapable of remembering both a root and a user password. Their excuse, I reckon, is "simplicity." But I have found that simplicity and security are often independent variables.
i think that they (the makers of some distros) think that an inexperienced user should use sudo instead of logging in as root. actually, i'd agree with them. there is too much danger for the inexperienced at a root shell prompt. @frankbell: you and i could handle working at a root prompt. most users could, back in the day when Linux (and BSD) first came out for those PeeCee machines. today, must users cannot safely be at a root prompt.

they should learn how their shell lets them edit a command. then they should learn to be even safer by typing in their command without "sudo " and add that in last after they made it past a fat-finger command error.

and they should learn a text file editor of their choice.

before i retired, i actually hired sysadmins for a few jobs. during the interview, i put them at a root shell on a machine (a real dedicated one, laptops would be the thing these days) i was also on in a window on my desktop. i carried out a command on it that caused most user things to break or stop working. i told the candidate that i just played like i was a dumb user on root and broke the system. "i'm timing you ... fix it". i didn't tell them what i broke as discovering why things did not work was the real test. this breakage was easy to do in a finger slip. i merely made / non-executable (i actually did such a slip myself a couple decades ago). i only hired those who figured it out (most did).
 
1 members found this post helpful.
  


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
/etc/passwd vs /etc/sudoers **add user to super user** andrewysk Linux - Newbie 4 08-01-2021 05:53 PM
[SOLVED] [sudoers]How-to edit '/etc/sudoers'? anon093 Linux - Security 3 01-02-2021 01:51 PM
[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
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 09:51 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