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 - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-26-2013, 01:32 PM   #1
lslack
LQ Newbie
 
Registered: Oct 2013
Posts: 4

Rep: Reputation: Disabled
Giving sudo access to a user by adding to a group


I have two users as follows
user: srvur1 group: hmadmin
user: srvur2 group: hmuser, hmadmin

The user 'srvur2' is a part of multiple groups. His primary group is 'hmuser'.

I have the following entry in /etc/sudoers
%hmadmin ALL=(ALL) NOPASSWD: ALL

With this entry the user 'srvur1' is able to execute sudo without password. But when 'srvur2' tries to sudo, it asks for password.

I want only certain users of 'hmuser' group to have sudo access, so I am trying to give them access by adding those users to 'hmadmin' group also, but this is not working.

I dont want to add the user 'sprur2' to /etc/sudoers as I have many servers and users, and managing the sudoers file would get difficult.

Is it possible to give sudo access to a user by adding him to a group which has sudo access? Does sudo work when a user is in multiple groups?

Please help
 
Old 10-27-2013, 07:06 AM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
Quote:
Originally Posted by lslack View Post

Is it possible to give sudo access to a user by adding him to a group which has sudo access? Does sudo work when a user is in multiple groups?
It should. Try to uncomment the wheel line
Quote:
Originally Posted by /etc/sudoers
## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
and add the users to the wheel group. Shouldn't be any different than your group, but it is much simpler and less likely that you will make a typo.
 
Old 10-29-2013, 05:59 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,365

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
I don't think using the wheel group is a good idea; its effectively the root group.

If this is going to be used in a script, try newgrp http://linux.die.net/man/1/newgrp
 
Old 10-29-2013, 07:30 PM   #4
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
Quote:
Originally Posted by chrism01 View Post
I don't think using the wheel group is a good idea; its effectively the root group.

If this is going to be used in a script, try newgrp http://linux.die.net/man/1/newgrp
Not if you edit the line granting the wheel group certain access.
 
Old 11-03-2013, 11:48 PM   #5
theace18
LQ Newbie
 
Registered: Jun 2012
Posts: 25

Rep: Reputation: Disabled
I believe your syntax in your sudoers file could be wrong.

If you want to give a group sudo rights with NOPASSWD, it should be:

%GROUPNAME ALL = NOPASSWD:COMMANDS

So in your case:

%hradmin ALL = NOPASSWD: ALL

Try that.


Quote:
Originally Posted by lslack View Post
I have two users as follows
user: srvur1 group: hmadmin
user: srvur2 group: hmuser, hmadmin

The user 'srvur2' is a part of multiple groups. His primary group is 'hmuser'.

I have the following entry in /etc/sudoers
%hmadmin ALL=(ALL) NOPASSWD: ALL

With this entry the user 'srvur1' is able to execute sudo without password. But when 'srvur2' tries to sudo, it asks for password.

I want only certain users of 'hmuser' group to have sudo access, so I am trying to give them access by adding those users to 'hmadmin' group also, but this is not working.

I dont want to add the user 'sprur2' to /etc/sudoers as I have many servers and users, and managing the sudoers file would get difficult.

Is it possible to give sudo access to a user by adding him to a group which has sudo access? Does sudo work when a user is in multiple groups?

Please help
 
  


Reply

Tags
sudo, user group



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
Sudo access for a group of users slufoot80 SUSE / openSUSE 1 09-16-2013 09:29 AM
Group permissions: user can't access 770 directory even though a member of group jm34003 Linux - Security 13 05-16-2012 02:03 PM
Giving all access to group. swamprat Linux - Newbie 1 01-25-2012 02:39 PM
Giving a user sudo 06jer Linux - Newbie 5 09-05-2007 07:49 PM
Giving user/group permissions to read&write Windows partitions? zaqwe Slackware 3 08-26-2007 11:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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