LinuxQuestions.org
Review your favorite Linux distribution.
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 04-14-2010, 04:19 PM   #1
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Rep: Reputation: 30
sudo setup


Here is another sudo posting from me.,

I have a user x belongs to group X and a user y belongs to group Y. These two groups are not related to each other by any means.

I want user x to sudo into y as

sudo su - y

How can I setup that? I don't want others in group Y to do that.
 
Old 04-14-2010, 04:41 PM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
/etc/sudoers
Code:
x ALL=(y) ALL
The user x may run any command on any host, but only as y.
E.g
Code:
sudo -u y /bin/ls
sudo su y
By default, sudo requires that a user authenticate him before running a command.

Last edited by troop; 04-15-2010 at 01:39 AM.
 
0 members found this post helpful.
Old 04-14-2010, 04:52 PM   #3
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Original Poster
Rep: Reputation: 30
troop,

Do you mean in /etc/sudoers? . AM using Redhat EL4
 
Old 04-14-2010, 05:01 PM   #4
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
yes, add the string to your /etc/sudoers
 
Old 04-14-2010, 05:54 PM   #5
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by ZAMO View Post
troop,

Do you mean in /etc/sudoers? . AM using Redhat EL4
Edit the file with the visudo command
 
Old 04-14-2010, 06:39 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by troop View Post
Code:
x ALL=(y) ALL
This line lets user "x" run ALL commands on ALL hosts as Runas_Alias "y". While the OP remains responsible for questioning the quality and effect of any "advice" given that is NOT what the OP is asking for. Even worse this deliberately weakens security posture without you warning him. I strongly suggest you edit your post to reflect this. If you don't or won't then please keep from posting "advice".
 
Old 04-15-2010, 01:40 AM   #7
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
Quote:
Originally Posted by unSpawn View Post
While the OP remains responsible for questioning the quality and effect of any "advice" given that is NOT what the OP is asking for.
Quote:
Originally Posted by ZAMO View Post
I want user x to sudo into y
Why not?

Quote:
Originally Posted by unSpawn View Post
Even worse this deliberately weakens security posture without you warning him. I strongly suggest you edit your post to reflect this.
ok.
 
Old 04-15-2010, 02:22 AM   #8
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by unSpawn View Post
This line lets user "x" run ALL commands on ALL hosts as Runas_Alias "y". While the OP remains responsible for questioning the quality and effect of any "advice" given that is NOT what the OP is asking for. Even worse this deliberately weakens security posture without you warning him. I strongly suggest you edit your post to reflect this. If you don't or won't then please keep from posting "advice".
I don't see how it weakens security. OP asked for 'su -y' for x.
After 'su -y' x can do whatever y can do.

troop suggested solution that allows run any command as y. Why it's weaker security ?
It seems to me that in both cases x can do anything y can.
 
Old 04-15-2010, 02:42 AM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
The fact that allowing user x to 'su' to y undermines the purpose of Sudo should be mentioned, yes, and while you're right to conclude that after 'su' x can do whatever y can do but the OP asked for a specific command which is in line with the purpose of Sudo: to allow granular control over what specific commands a user may run.
 
Old 04-15-2010, 03:12 AM   #10
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by unSpawn View Post
The fact that allowing user x to 'su' to y undermines the purpose of Sudo should be mentioned, yes, and while you're right to conclude that after 'su' x can do whatever y can do but the OP asked for a specific command which is in line with the purpose of Sudo: to allow granular control over what specific commands a user may run.
Quote:
I want user x to sudo into y as

sudo su - y
It doesn't look for me like OP wants granular control.

And I don't think it's undermines the purpose of Sudo:
after all ALL is built into sudo exactly for the cases OP asked about.
 
Old 04-15-2010, 04:50 PM   #11
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Original Poster
Rep: Reputation: 30
Thanks for everyone here to help me.

Thanks for everyone here to help me.

It worked for me with

Code:
x ALL=ALL
There is no security concerns as user "x" has no access to other servers .
Am sorry to say, it may be my fifth(or more) posting here regarding sudo. I don't know why am allergetic to "sudo" . I have a learn a lot in sudo.

Thanks again for a useful discussion from all.
 
  


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
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
Getting error "sudo: unable to execute ./setup: Success" d_girish_d Linux - Software 3 07-20-2009 11:33 PM
Problem with SUDO : sudo: pam_authenticate: Module is unknown cristoph_ Linux - Software 2 03-02-2009 07:12 PM
How to setup user's PATH env when sudo command in RHEL5? sailer_sh Red Hat 3 12-22-2008 07:36 PM
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM

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

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