Link to home
Create AccountLog in
Avatar of vamsi_uk
vamsi_uk

asked on

Sudo Access on Solaris

Hi Experts,

I have a script which is owned by user1. I want user2 to be able to execute this script for which i want user2 to use sudo. So far i have tried this..

/usr/local/sbin/visudo

User_Alias  TEST = user1
Runas_Alias TEST = user1

user2    ALL=(TEST) ALL

Now when i try the following command i get an error:

[user2@sun4]$ sudo ./test.sh
Sorry, user user2 is not allowed to execute './test.sh' as root on sun4.


I am not sure why or how i can execute the script of user1 using sudo

Thanks in advance
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

Here example on how to use sudo:

Entry in /etc/sudoers

dgb    boulder = NOPASSWD: (operator) /bin/ls, /bin/kill, /usr/bin/lprm

The user dgb may run /bin/ls, /bin/kill, and /usr/bin/lprm -- but only as operator.  E.g.,

  $ sudo -u operator /bin/ls

In your case:

user2    boulder = NOPASSWD: (user1) ./test.sh

Here some useful links:

http://www.hmug.org/man/5/sudoers.php
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch09_:_Linux_Users_and_Sudo
http://sudo.rtin.bz/sudo/sample.sudoers
ASKER CERTIFIED SOLUTION
Avatar of PsiCop
PsiCop
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account