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 08-22-2019, 09:43 AM   #1
AndyAjram
LQ Newbie
 
Registered: Aug 2019
Posts: 20

Rep: Reputation: Disabled
Add existing user to Sudoers


Hello everyone,

I have a user that can do root actions , and I want to add an other existing user to the sudoers group , but when I try
Code:
sudo usermod -a -G sudo eibusrpp
I get usermod: group 'sudo' does not exist

what is the solution ?

Thanks in Advance
 
Old 08-22-2019, 09:53 AM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Code:
cat /etc/group
look at your groups, --> wheel if you go that add use to that group.
id yourself to see if you got wheel that too is a sudoers group, check your sudoers file for the wheel setting. admin stuff you need to do to confirm your questions on whos sudo group am I using?
 
Old 08-22-2019, 09:54 AM   #3
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,477

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Nothing to do with groups, everything to do with:
Code:
/etc/sudoers
Try reading that file and:
Code:
man sudoers
man visudo
 
Old 08-22-2019, 09:57 AM   #4
AndyAjram
LQ Newbie
 
Registered: Aug 2019
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by BW-userx View Post
Code:
cat /etc/group
look at your groups, --> wheel if you go that add use to that group.
id yourself to see if you got wheel that too is a sudoers group, check your sudoers file for the wheel setting. admin stuff you need to do to confirm your questions on whos sudo group am I using?
Wheel exist in the file group with wheel:x:10:
 
Old 08-22-2019, 10:05 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
Which individual command or commands do you wish to grant privileges for to the new account? sudo can be configured with great detail, if it is done right.
 
Old 08-22-2019, 10:07 AM   #6
AndyAjram
LQ Newbie
 
Registered: Aug 2019
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
Which individual command or commands do you wish to grant privileges for to the new account? sudo can be configured with great detail, if it is done right.
I want to give it the root access , all privileges must be granted to this user
 
Old 08-22-2019, 10:14 AM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by TenTenths View Post
Nothing to do with groups, everything to do with:
Code:
/etc/sudoers
Try reading that file and:
Code:
man sudoers
man visudo
yes it does, you need a group to be attached to to get general sudo privs period. wheel or sudo if you want to play customized sudoers config fine, but for most users it is just the means to attach a user to the group, wheel or sudo and have the permissions to that group set.
Code:
root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

## Same thing without a password
 %wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo	ALL=(ALL) ALL
notice the two groups mentioned in sudoers conf, wheel sudo

that too is why I told OP to check his id and the sudoer config file to put two and two together. Whence he figures out what he has to get sudo privs then he can mimic that for the other, anything more then he too can ask, or look into it.

Last edited by BW-userx; 08-22-2019 at 10:17 AM.
 
Old 08-22-2019, 10:17 AM   #8
AndyAjram
LQ Newbie
 
Registered: Aug 2019
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by BW-userx View Post
yes it does, you need a group to be attached to to get general sudo privs period. wheel or sudo if you want to play customized sudoers config fine, but for most users it is just the means to attach a user to the group, wheel or sudo and have the permissions to that group set.
Code:
root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

## Same thing without a password
 %wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo	ALL=(ALL) ALL
notice the two groups mentioned in sudoers conf, wheel sudo
I don't understand you , I'm not familiar with linux , so can you be more explicit
 
Old 08-22-2019, 10:23 AM   #9
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by AndyAjram View Post
I don't understand you , I'm not familiar with linux , so can you be more explicit
read up on sudo to get a basic understanding of it. id yourself
Code:
$ id
uid=1000(userx) gid=1000(userx) groups=1000(userx),0(wheel),5(operator),44(video)
to see what group you're in for sudo. sudo nano /etc/sudoers or just nano /etc/sudoers so changes cannot take place, and take a look through it. mostly on the bottom to see how to give a user attached to the group wheel or sudo root privs.


so you need to find out what group is being used, what is your group, or are you logged in as root? what distro are you using too is a big thing. some use sudo and others use wheel. you can give a user rights in the sudoers file for specific commands, but again go back to read up on sudo how to's to get yourself more understanding of sudo.

if this is just a general give user root privs then find the group your system is using to do so, then use that one.

Because if you already have sudo and it works with your user then your sudoers file is already setup for additional user to be put in that group for the same privileges.

Last edited by BW-userx; 08-22-2019 at 10:25 AM.
 
Old 08-22-2019, 10:24 AM   #10
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,477

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by BW-userx View Post
you need a group to be attached to to get general sudo privs period.
Wrong, privs can be assigned at individual user levels in /etc/sudoers, no group necessary.

Directly assigning individual users makes it easier to see in the file who can do what.

But hey, not getting in to a "measuring contest" here so whatever.
 
Old 08-22-2019, 10:28 AM   #11
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by TenTenths View Post
Wrong, privs can be assigned at individual user levels in /etc/sudoers, no group necessary.

Directly assigning individual users makes it easier to see in the file who can do what.

But hey, not getting in to a "measuring contest" here so whatever.
I was speaking in general terms . as you should know that one attached to wheel, or sudo gets root privileges, depending on what system they are using, even though you're speaking in specific commands root privileges need to be had to run.
 
Old 08-22-2019, 10:48 AM   #12
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
It would help if you say which distribution you want to do this in. Given you're using the usermod command; am I right in assuming this user you wish to give sudo rights to already exists on your system?

Because it depends on the distribution concerned as to which user group is configured in /etc/sudoers From my searches, in Ubuntu it's the "sudo" group that you need to add the user to, that you wish to give sudo rights to. In other distributions it might be the "wheel" group, like in the distribution I'm using. Although, you can change which group has sudo rights in the /etc/sudoers file (you can use any text editor to edit that file - it doesn't matter what text editor you use).
 
Old 08-22-2019, 10:54 AM   #13
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
As has been said, you need to edit suduers. Read all about it here
https://wiki.archlinux.org/index.php/Sudo

The point about the command visudo is that it checks your edit before saving: if you seem to have made a mistake it asks you if you want to try again, save and risk it, or give up! Normally it uses vi as an editor. If you want to avoid that, use the command
export EDITOR=nano
(or whatever you want to use as the editor). I always put that in my .bashrc file.
 
1 members found this post helpful.
Old 08-22-2019, 11:09 AM   #14
AndyAjram
LQ Newbie
 
Registered: Aug 2019
Posts: 20

Original Poster
Rep: Reputation: Disabled
I did it , I added my user to the sudoers file and now it has the root privilege

thank you all
 
  


Reply

Tags
linux, root, sudoers



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] Add existing unix user to existing LDAP antoniemail Linux - Server 7 06-23-2010 12:54 PM
add an existing user to an existing group? tramni1980 Slackware 5 05-08-2008 07:28 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 05:28 AM.

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