The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Use of sudoer with ssh login shell script (KSH) rockysfr UNIX for Advanced & Expert Users 0 06-30-2007 08:28 PM
Passing parameters through a file chawlaaman Shell Programming and Scripting 3 07-17-2006 11:56 AM
Failed to export parameters from configuration file nir_s Shell Programming and Scripting 5 01-16-2006 12:03 AM
Another SUDOER Question... scottsl UNIX for Advanced & Expert Users 0 11-11-2005 02:03 PM
Root privileges &Sudoer blue_7 UNIX for Dummies Questions & Answers 2 06-09-2004 01:05 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-08-2007
Registered User
 

Join Date: Jun 2007
Posts: 24
Sudoer file - controlling parameters

Greetings all,

I'm interested in knowing more about setting up the sudoers file... hope to receive some advice here.

Let's say that I have 3 users, with usernames user1, user2 and user3. The following rules would apply for each user:

user1 can only use the command ksh a.sh to launch himself into the a.sh shell script.

user2 can only use the command ksh b.sh ABC to launch himself into the b.sh shell script. The 3rd argument (or parameter) must strictly be the string "ABC", else we should deny access.

user3 can only use the command ksh b.sh DEF to launch himself into the b.sh shell script. The 3rd argument (or parameter) must strictly be the string "DEF", else we should deny access.

What are the declarations that I should make in the sudoer file for each of the 3 users?

Thanks in advance.
Reply With Quote
Forum Sponsor
  #2  
Old 07-20-2007
Registered User
 

Join Date: Jul 2007
Posts: 110
1. add the below line at the top of scripts a.sh and b.sh(check exact path of ksh on your system) to avoid using ksh to run the scipts.

#!/usr/bin/ksh

2. put the scripts alongwith arguments into another script:

echo "b.sh ABC" >/sbin/user2_script.sh;chmod +x /sbin/user2_script.sh
echo "b.sh DEF" >/sbin/user3_script.sh; chmod +x /sbin/user3_script.sh


3. add the below entries to sudoers file:


user1 ALL = NOPASSWD: /sbin/a.sh (whatever path exactly on your system)
user2 ALL = NOPASSWD: /sbin/user2_script.sh
user3 ALL = NOPASSWD: /sbin/user3_script.sh



DONE
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0