1846336 Members
3342 Online
110256 Solutions
New Discussion

execute as root?

 
Joseph Hoh
Frequent Advisor

execute as root?

How can I set a shell script to execute as root by another user. I don't want the user to be able to modify the script.
5 REPLIES 5
MARTINACHE
Respected Contributor

Re: execute as root?

Hi,

You should use "sudo".

You can doawnload it from :
http://hpux.cs.utah.edu/

regards,

Patrice.
Patrice MARTINACHE
f. halili
Trusted Contributor

Re: execute as root?

There's a shareware called 'sudo'. This package determines which users have the privilege to operate as su. I believe HP does not support this utility.

You can find 'sudo' at the following web site:
http://hpux.cs.utah.edu/
Once you access the site:

1. Type 'sudo' in the 'Package Search:' field.
2. Click the 'Search' button.
3.Click the 'sudo-1.5.6p5' link for more information.
derekh
Dan Hetzel
Honored Contributor

Re: execute as root?

Hi Jeff,

A solution would be to use 'SUDO' that you can freely download at the following address:
http://www.courtesan.com/sudo/sudo.html

This utility allows you do define 'who' may run 'what' and under which usedid. It's quite powerful.

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
federico_3
Honored Contributor

Re: execute as root?

you should use the Set owner id.

For example:
let 's suppose we have two files
-rwsr-xr-x root group1 stick_file ( chmod 4755 stick_file)
-rwxr--r-- root group1 teststick

the file stick_file is like this:
############################
#! /usr/bin/ksh
echo 'who am i : \c"
whoami
./teststick
############################
teststick is:
##################
echo TEST
##################


and this command will be executed as root whatever user i use to run stick_file ( see this file permissions ).


i hope this helps


Federico




Rick Garland
Honored Contributor

Re: execute as root?

Using sudo will accomplish this and keep a log of the activity done as the sudo-root user.

The log will enable you to keep track of who did what and when.