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 - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-08-2019, 10:56 PM   #1
Captain Brillo
Member
 
Registered: Jul 2018
Location: Capital of Raccoon Nation
Distribution: Manjaro Cinnamon
Posts: 183

Rep: Reputation: 25
how to add user to sudo group


Having trouble with adding users.
The user I added during installation isn't there.
Trying to "adduser" but I'm unable to add any users to the "sudoers" group. At least, that's the group name the error message has.

So how do I get to use "sudo" as an ordinary user?

If I use kuser the group list does not include "sudo"

adduser did not give me an option for that

So how the frack can I use a box if I can't "sudo" ?
What have I missed here?

Last edited by Captain Brillo; 06-08-2019 at 11:17 PM.
 
Old 06-09-2019, 12:43 AM   #2
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
As root, run:
Code:
visudo
which is a vi editing interface to the sudo configuration file. Near the bottom is a commented out line saying "# %sudo ALL=(ALL) ALL". Uncomment that line, save & exit. That will give all users sudo acccess - probably good enough if you're the only user on the machine. You can also limit sudo access to particular users or groups - see other examples in the configuration file. See also:
Code:
man sudoers
If vi isn't an editor you're familiar with, you can edit the configuration file /etc/sudoers directly with your favourite editor.
 
Old 06-09-2019, 01:06 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,306
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
Remember, both, that it is misuse of sudo to configure it as all-or-nothing. Such misuse is unsafe. Accounts should be granted just enough privilege to accomplish the tasks they need to, no more, no less.

Yes, "man sudoers" is the ultimate reference, but manual pages are not tutorials and the one for sudoers is particularly long. So for the time being I would recommend the online presentation by Michael W Lucas, "sudo: You're Doing It Wrong". He'll have a new edition of "sudo Mastery" out soon, but for the immediate question, the presentation will have to do. There is both video and slides, but it is quite long.
 
Old 06-09-2019, 05:56 AM   #4
Captain Brillo
Member
 
Registered: Jul 2018
Location: Capital of Raccoon Nation
Distribution: Manjaro Cinnamon
Posts: 183

Original Poster
Rep: Reputation: 25
It appears that this install has no "sudoers" group.
The man pages are confusing as heck.

How do I fix this?
 
Old 06-09-2019, 06:05 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,306
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
There is no group "sudoers", just the file /etc/sudoers and the files beneath the directory /etc/sudoers.d/ which contain the configurations.

The whole thing works on whitelisting commands with options. Which specific commands do you want to allow the account to run?
 
Old 06-09-2019, 06:18 AM   #6
Captain Brillo
Member
 
Registered: Jul 2018
Location: Capital of Raccoon Nation
Distribution: Manjaro Cinnamon
Posts: 183

Original Poster
Rep: Reputation: 25
I just want to be able to use sudo when I need to, and not have to logout/in as root.

Having a bugger of a time getting this Slackware working - little issue after little issue - starting to feel like I'm wasting my time.
 
Old 06-09-2019, 06:23 AM   #7
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Quote:
Originally Posted by Captain Brillo View Post
It appears that this install has no "sudoers" group.
The man pages are confusing as heck.

How do I fix this?
What I do is uncomment the '# %wheel ALL=(ALL) ALL" line and make myself a member of the wheel group. You'll need to logout/login for that to take effect.

You could also make an entry similar to the one for root but substituting your own name e.g. 'fred ALL=(ALL) ALL'. You could further refine that entry by restricting the sudo privilege to a number of particular commands that you may want to use (which is why Turbocapitalist is asking which commands you'll want to run with sudo).
 
Old 06-09-2019, 07:00 AM   #8
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by Captain Brillo View Post
I just want to be able to use sudo when I need to, and not have to logout/in as root.

Having a bugger of a time getting this Slackware working - little issue after little issue - starting to feel like I'm wasting my time.
Seems to me that you are tackling Slackware as it it were Ubuntu. DON'T.
Slackware does things differently, i.e. it has not changed handling things since its inception. All the other distro's have surfaced after Slackware was already established, they may do things differently from Slackware but that does not mean Slackware does them the wrong way.
Think again why you started with Slackware, and ask yourself if you made the right choice. If the answer is "YES" then treat Slackware for the OS that it is.
 
2 members found this post helpful.
Old 06-09-2019, 07:03 AM   #9
Captain Brillo
Member
 
Registered: Jul 2018
Location: Capital of Raccoon Nation
Distribution: Manjaro Cinnamon
Posts: 183

Original Poster
Rep: Reputation: 25
Super!
Unfortunately, visudo has me beat, too.
It opens but I can't do anything, seems to be read-only.
And I'm logged in as root - what's with this?
 
Old 06-09-2019, 07:15 AM   #10
Captain Brillo
Member
 
Registered: Jul 2018
Location: Capital of Raccoon Nation
Distribution: Manjaro Cinnamon
Posts: 183

Original Poster
Rep: Reputation: 25
Alien Bob:
I hear you - but having a bit of trouble with NOT thinking Ubuntu/Mint etc. Thanks for your comment.

I guess part of my problem here is that there's so much documentation in Slack Docs I'm getting overloaded.
 
Old 06-09-2019, 07:34 AM   #11
interndan
Member
 
Registered: Aug 2004
Location: near Marion, Ill
Distribution: Slackware 15 64bit on Desktop Slackwarearm on Raspberry PI v1b
Posts: 381

Rep: Reputation: 38
If you have a full system install you can use kdesu for single tasks. Example: from menu -run type kdesu thunar for a root file manager.
 
Old 06-09-2019, 07:43 AM   #12
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,570
Blog Entries: 19

Rep: Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451Reputation: 4451
Quote:
Originally Posted by chris.willing View Post
If vi isn't an editor you're familiar with, you can edit the configuration file /etc/sudoers directly with your favourite editor.
That's a very dangerous thing to do! Visudo does a syntax check after filing the temporary saved file and before copying it over to overwrite the original. That means that if you made a syntax error, it will be reported and you can go back, double-check the change you made and correct it.

If you edit sudoers directly you don't get that check. And if sudoers is saved with a syntax error in it, sudo won't work any more.

The right way to do this is to set the EDITOR environmental variable to be your favourite editor and then use visudo.

If it's just a matter of shutting down or rebooting, most sudoers files include an alias for these commands, and you can give yourself sudo access to this (without a password if you like).
 
1 members found this post helpful.
Old 06-09-2019, 07:46 AM   #13
Captain Brillo
Member
 
Registered: Jul 2018
Location: Capital of Raccoon Nation
Distribution: Manjaro Cinnamon
Posts: 183

Original Poster
Rep: Reputation: 25
Can somebody explain why "visudo" seems to be read-only?
 
Old 06-09-2019, 08:03 AM   #14
Captain Brillo
Member
 
Registered: Jul 2018
Location: Capital of Raccoon Nation
Distribution: Manjaro Cinnamon
Posts: 183

Original Poster
Rep: Reputation: 25
Thanks, all.
Finally managed to get at the "sudoers" file, and modified it like chris.willing suggested.
Now I'm ok.
 
Old 06-09-2019, 08:05 AM   #15
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 687
Blog Entries: 1

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by Captain Brillo View Post
Can somebody explain why "visudo" seems to be read-only?
Are you executing visudo as root ? If so, what makes you think it is read-only, visudo will create a temp file, you change that then /etc/sudoers will be updated when you save and exit

EDIT - looks like Captain figured it out while I was typing this

Last edited by jmccue; 06-09-2019 at 08:07 AM.
 
  


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
[SOLVED] How to add a user to a group with a command without removing from another group? erik2282 Linux - Newbie 2 07-12-2017 09:49 AM
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
Block bitmap for group 416 not in group (block 0) + group descriptors corrupted? quanta Linux - Server 1 12-08-2010 10:40 AM
group: add complete group into other group max_mad SUSE / openSUSE 1 04-12-2006 01:43 AM
Group Admin, Group Root, or God over Group crickett Linux - General 5 07-12-2004 04:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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