How a normal user run a script including root privileaged commands

Dear all
Ihave written a script in Hpux9.0, the ecript is working fine if I run it from root command prompt
But when I am running it thru /etc/profile or /user/.profile and login as a normal user, the owner of the process running the script is the normal user & hence cant run a root privileaged command
so pls help how can i run that script, so that a normal user when logs in the script should start in background with root privileages.
Thanks in advance
Nitin M

I just answered this on ITRC, so here's the pasted text:

This can be done with sudo.

Run this command to edit the sudoers file:
visudo

Add something like this (for 'user1' as example):
user1 ALL = NOPASSWD: /path/to/script.sh

Then in the user1 .profile, add this:
sudo /path/to/script.sh &

This will run the command as root in the background. For more information on sudo:

Sudo Main Page

Thanks dear ,
But I am using HPux 9.0 & I dont have the sudo installed & not available on for download also.

You should be able to compile sudo from source on HP-UX 9.0. Check the download section on the sudo home page.

Sudo download with prepared binaries. (no 9.x though)

Get your system administrator to change the ownership of the file to root and then change the file permissions to add the set user-ID bit.

chown root filename
chmod u+s filename

When you 'ls' the file you'll see an output such as:

-rwsrwxrw- root    root    filename

I believe that if you then edit the script, you'll lose the s bit, as otherwise there a huge security loophole!

Hope that helps.

Jerry

The safe response is to create a root cron which polls for a user-generated
flag file. On finding the flag file the root cron executes the desired script
and then removes the flag file.

We cannot endorse upgrading the privilege of shell scripts with SUID
techniques in this context.

We are slightly concerned about the motives of this post.

Sudo is irrelevant on HPUX 9.0, but remains a useful tool in modern OS.

Thanks