Operating System - HP-UX
1846622 Members
1707 Online
110256 Solutions
New Discussion

Re: User permission for script execution

 
M.Thomas
Frequent Advisor

User permission for script execution

I need to create a user who needs to execute a script (the script runs lpstat commands)this user should only be able to to only access and execute the script. I have the sudoers file. can i set it up there? how do i set this up?

Thanks

Thomas
3 REPLIES 3
Ivan Krastev
Honored Contributor

Re: User permission for script execution

For example :

user1 ALL = NOPASSWD : /path/script


regards,
ivan
spex
Honored Contributor

Re: User permission for script execution

Hi Thomas,

Add the following to ~user/.profile:

exec yourscript
exit

Once the script exits, the user will be logged off.

Alternatively, you could modify /etc/passwd to change the user's shell to yourscript. If you decide to go with this option, make sure /path/to/yourscript appears in /etc/shells.

PCS
jerry1
Super Advisor

Re: User permission for script execution

Yes, sudo is what I use here for the
techs to run printer commands.
Here is my setup. I have only put for
Cmnd_Alias the script name and the cancel
command that is in the script so they
can purge queues as cancel -e that
is in the printer_maintenance script as
an example. You have to do a sudo at one
point before they can run the commands
without the sudo in a script.
sudo caches their password for a while
so it does not keep asking them for it.:


# Add users to group HELPDESK.
User_Alias HELPDESK=user1

# Add commands they can run with sudo.
Cmnd_Alias HELPDESK=/usr/local/bin/printer_maintenance, \
/usr/bin/cancel

# Add servers and command alias.
HELPDESK ALL=HELPDESK