Sudoer file - controlling parameters


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Sudoer file - controlling parameters
# 1  
Old 07-08-2007
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.
# 2  
Old 07-20-2007
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

"rhgb quiet" controlling the display of commands in single user mode ?"rhgb quiet" controlling the d

Why does removing "rhgb quiet" from the kernel boot parameters control whether or not the commands I enter are displayed in single user mode ? For instance, if I do not remove "rhgb quiet", when I am in single user mode, whatever command I type will not be displayed on the screen. The... (0 Replies)
Discussion started by: Hijanoqu
0 Replies

2. Linux

Syntax error in one line in sudoer file cause total failure

I have notice that when I create a sudoer file in the sudoer.d directory, then if I have a syntax error, I cannot do sudo at all, in all accounts. Why can't they change the mechanism, so it will ignore syntax error line and will only display error message but won't cause total failure and... (7 Replies)
Discussion started by: programAngel
7 Replies

3. Shell Programming and Scripting

Shell Script to Dynamically Extract file content based on Parameters from a pdf file

Hi Guru's, I am new to shell scripting. I have a unique requirement: The system generates a single pdf(/tmp/ABC.pdf) file with Invoices for Multiple Customers, the format is something like this: Page1 >> Customer 1 >>Invoice1 + invoice 2 >> Page1 end Page2 >> Customer 2 >>Invoice 3 + Invoice 4... (3 Replies)
Discussion started by: DIps
3 Replies

4. Shell Programming and Scripting

Run a program-print parameters to output file-replace op file contents with max 4th col

Hi Friends, This is the only solution to my task. So, any help is highly appreciated. I have a file cat input1.bed chr1 100 200 abc chr1 120 300 def chr1 145 226 ghi chr2 567 600 unix Now, I have another file by name input2.bed (This file is a binary file not readable by the... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

5. UNIX for Advanced & Expert Users

parameters file

Hi, on AIX 6.1 I have a shell script that calls another shell which have some parameters. Say like the following : ##This is main script############ myparameters.sh command1 command2 ..... .... And here myparameteres.sh : export ORACLE_SID=MYDB export... (6 Replies)
Discussion started by: big123456
6 Replies

6. AIX

tuning network parameters : parameters not persist after reboot

Hello, On Aix 5.2, we changed the parameters tcp_keepinit, tcp_keepintvl and tcp_keepidle with the no command. tunrestore -R is present in inittab in the directory /etc/tunables we can clearly see the inclusion of parameters during reboot, including the file lastboot.log ... (0 Replies)
Discussion started by: dantares
0 Replies

7. UNIX for Advanced & Expert Users

Sudoer Help....

Hi, When i use command "sudo -l" under my user, it gives me the following list. (root) NOPASSWD: /bin/chgrp (root) NOPASSWD: /bin/chmod (root) NOPASSWD: /bin/chown (root) NOPASSWD: /bin/mkdir (root) NOPASSWD: /bin/su - hubsup (root) NOPASSWD: /bin/su hubsup ... (1 Reply)
Discussion started by: jitendriya.dash
1 Replies

8. UNIX for Advanced & Expert Users

Use of sudoer with ssh login shell script (KSH)

Greetings all, I'm in the midst of writing a login component for a series of shell scripts. What my login script does is this: 1. Prompt for username and read in username 2. Prompt for destination host and read in destination host 3. run ssh username and destination host 4. After user keys... (0 Replies)
Discussion started by: rockysfr
0 Replies

9. UNIX for Advanced & Expert Users

Another SUDOER Question...

I have my sudoers file setup to provide execution of specific directories (/a/s, /a/x, /a/d, /a/e, etc.....) I tried to list just /a/ meaning anything under /a can be executed by specific ids. However, this didn't work. Is there a way to provide rights to an entire directory structure within a... (0 Replies)
Discussion started by: scottsl
0 Replies

10. UNIX for Dummies Questions & Answers

Root privileges &Sudoer

Hi guys... how can a root assign a user all or most of the root privileges? is sudoer comand enough 4 this? thx alot.. (2 Replies)
Discussion started by: blue_7
2 Replies
Login or Register to Ask a Question