System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

how to write su in shell script

 
Dennis Handly
Acclaimed Contributor

Re: how to write su in shell script

>Sorry, it will not happen in future.

You need to retroactively assign points to all of your replies:
http://forums.itrc.hp.com/service/forums/pageList.do?userId=WW229563&listType=unassigned

>sudo su - kumar -c "id"
Password:
>kindly help to sort out this issue

This means that sudo is not switching to root for this particular user and/or command.
What is it configured to allow?
rajesh73
Super Advisor

Re: how to write su in shell script

i have configure in sudoers file

/usr/bin/su - kumar



Dennis Handly
Acclaimed Contributor

Re: how to write su in shell script

>I have configure in sudoers file
/usr/bin/su - kumar

Does it check to see that the "-c ..." is different?
rajesh73
Super Advisor

Re: how to write su in shell script

Sorry dennis,

i am not understand your input
Highlighted
Dennis Handly
Acclaimed Contributor

Re: how to write su in shell script

>I am not understand your input

Does sudo check for an exact match of the command and ALL the options or only a prefix match?

Does your "/usr/bin/su - kumar" allow:
sudo su - kumar -c "id"
sudo su - kumar -c "cd /home/kumar/lic && /path/to/lmstat lic"