LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   AIX (https://www.linuxquestions.org/questions/aix-43/)
-   -   Help required to setup sudoers file (https://www.linuxquestions.org/questions/aix-43/help-required-to-setup-sudoers-file-798870/)

mufy 03-30-2010 07:38 AM

Help required to setup sudoers file
 
Hi,

This is my scenario -
There're 7 users who should be able to bring up and bring down the application. The users will basically login with their user IDs, su to a common account and execute the startup/shutdown commands from there. They should not be prompted for the password.

I'm having trouble carrying this out. Whatever I've tried, I'm being prompted to enter the password.

troop 03-30-2010 08:04 AM

Code:

user_login host_name = (as_user) NOPASSWD: commands
or
Code:

%group_name host_name = (as_user) NOPASSWD: commands
e.g
Code:

%adm ALL = (ALL) NOPASSWD: /sbin/shutdown -h now, reboot

mufy 03-30-2010 08:18 AM

This is my sudoers file:

Code:

User_Alias      B24GRP = b24adm
B24GRP  ALL = (b24prd) NOPASSWD : ALL

Is it wrong?

troop 03-30-2010 10:17 PM

B24GRP looks like group name. should be %B24GRP
Is b24prd priveleged user?
Code:

sudo -u b24prd command
shold work.

mufy 03-31-2010 07:59 AM

The sudoers file was fine. The issue was due to the way 'sudo' was used in the script.

sudoers file now is,
Code:

b24adm  ALL = (b24prd) NOPASSWD : ALL
Earlier, my script was:
Code:

su - b24prd <<EOF
. /<command1>
. /<command2>
. /<command3>
EOF

In the above, the script used to halt and prompt me for the password for b24prd.

Now, I've included the commands in a separate command.ksh file and use sudo in the script as:
Code:

sudo -u b24prd -i command.ksh


All times are GMT -5. The time now is 09:56 PM.