LinuxQuestions.org
Help answer threads with 0 replies.
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 07-30-2011, 07:57 PM   #1
tmy
LQ Newbie
 
Registered: Apr 2010
Posts: 6

Rep: Reputation: 0
sudoers Cmnd_Alias usage


Hi,
Inside of my sudoers file, I would like to give my DBA's the ability to switch to their Administrative accounts. I am currently using the Cmnd_Alias function to provide access to some commands, and want to give /bin/su, but need to limit the IDs available to them. Is it possible to specify /bin/su - <userid>?
How else can this be accomplished?

Thank you!
 
Old 07-31-2011, 06:41 AM   #2
rgdacosta
Member
 
Registered: Jun 2007
Location: South Africa
Distribution: Linux Mint,Fedora, openSUSE, RHEL, SLES, Scientific Linux
Posts: 71

Rep: Reputation: 25
Do you definitely want to do it by UID and not by USERNAME?
 
Old 08-01-2011, 05:55 AM   #3
tmy
LQ Newbie
 
Registered: Apr 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Sorry, I would like to provide the %dba group access to a specific username, like oracle. This way they can switch to oracle from their personal logins.

Thank you!
 
Old 08-01-2011, 08:04 AM   #4
rgdacosta
Member
 
Registered: Jun 2007
Location: South Africa
Distribution: Linux Mint,Fedora, openSUSE, RHEL, SLES, Scientific Linux
Posts: 71

Rep: Reputation: 25
Quote:
Originally Posted by tmy View Post
This way they can switch to oracle from their personal logins.
I could be misunderstanding your requirements but if you want to change your primary group from foo to bar you could use:

Code:
sg bar
You could also want to limit which users can make use of /bin/su in which case you could change the owning or named group of that file to oracle and delegate them that privilege via sudo.

Let me know in as much detail what you're trying to do.
 
Old 08-01-2011, 08:13 AM   #5
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
Add this line in your sudoers file to give every member of the dba group the rights to run any command as the userid oracle:

Code:
# User privilege specification
%dba     ALL = (oracle) ALL
Usage:

Code:
sudo -u oracle <command>
 
Old 08-02-2011, 06:10 AM   #6
tmy
LQ Newbie
 
Registered: Apr 2010
Posts: 6

Original Poster
Rep: Reputation: 0
I have the Cmnd_Alias DBA = /bin/su <-- allows people in the dba group to switch to any user they choose. I would like to restrict it to 1 specific user, which is the admiinistrative database user "oracle" can I set the Cmnd_Alias DBA = /bin/su - oracle? Can I identify 1 specific user that the /bin/su applies to in Cmnd_Alias? I've never done that before, and am not sure it would work. Then, I set the group dba to allow commands in DBA Cmnd_Alias...

%dba ALL = DBA

Thank you for helping me with this.
 
Old 08-02-2011, 06:59 AM   #7
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Yes, the executing user of the su command must be root though:
Code:
%dba ALL = (root) DBA
 
Old 08-02-2011, 08:42 AM   #8
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
Why on earth would you give a DBA full access to root? And if you're going to do that, why go through the exercise of creating a command alias to do it?
 
Old 08-02-2011, 09:38 AM   #9
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Only the /bin/su - oracle will run as root, and you end up as being logged in as oracle.

NB: I use this with NOPASSWD: in addition, so that user A can switch to user B without a password.
 
Old 08-03-2011, 06:02 AM   #10
tmy
LQ Newbie
 
Registered: Apr 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Thank you everyone! The command works great. I set the following:

## DBA
Cmnd_Alias DBA = /bin/su - oracle
%dba ALL = DBA

Which gives the DBA's the ability to switch to their admin account "oracle".
Thank you again, this was something I wanted to get put into production, and now I can. Have a great day!!!
 
  


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
sudoers question about cmnd_alias/list and directories. trey85stang Linux - General 2 12-02-2010 03:59 PM
LXer: sudo install, usage and sudoers config file basics LXer Syndicated Linux News 0 08-29-2010 12:30 PM
Cmnd_Alias entries in sudo Quakeboy02 Linux - Security 3 01-11-2010 01:00 AM
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
sudo - problem with cmnd_alias slackware stu Linux - Software 0 10-04-2003 12:48 AM

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

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