Operating System - HP-UX
1833827 Members
2034 Online
110063 Solutions
New Discussion

Can you help me with this script?

 
SOLVED
Go to solution
Ted Flanders
Frequent Advisor

Can you help me with this script?

 
7 REPLIES 7
Ted Flanders
Frequent Advisor

Re: Can you help me with this script?

Oops, sorry about the double post.
Ted Flanders
Frequent Advisor

Re: Can you help me with this script?

Nice, I double posted and they left this one, and deleted the post with all of the info in it.
I am trying to make a script to allow other users (ie. Branch Mgrs.) to shut and kill -9 users. The problem is, it doesnt allow users to shut or kill other users, just allows root to do so. Is there any way that I can make this work? Of course I dont want to give users root access. Thanks for your help.
Manuel Plaza
Regular Advisor
Solution

Re: Can you help me with this script?

Hi Ted,

You can use: SUDO that is an application for allow to other users to run commands with superuser permissions.
You can download it from:
http://hpux.connect.org.uk/

Regards,
Victor BERRIDGE
Honored Contributor

Re: Can you help me with this script?

Hi Ted,
I cant read your script (not found error??), but since its a script why not configure sudo (download it from your Archive Center..) for your users to execute your script as root...


All the best

Victor
Stefan Schulz
Honored Contributor

Re: Can you help me with this script?

The commands you are using seem to be ok. Think it has to do wtih the necessary rights.

Only root is allowed to kill another users process. If you are not root while running this script, you can't kill this process.

So make sure you are root while running this script or use something like sudo. You can find sudo at the porting center (e.g. http://hpux.asknet.de)

Hope this helps

Regards Stefan
No Mouse found. System halted. Press Mousebutton to continue.
Sridhar Bhaskarla
Honored Contributor

Re: Can you help me with this script?

Ted,

sudo is the best option anyway to work as root as it provides good logging facility as well controlling mechanism.

If your needs are immediate, then you can write a small script called kill_it and call it from your script.

Now your kill_it will be something like this

#!/usr/bin/ksh
#Only uid xxx can run this script
if [ `uid` -ne xxxxx ]
then
echo "You need to be with uid xxxx"
exit 1
else
kill -9 $1
fi

Now, create a group called and place this user in it. Let's call the group as sugroup.

Now as root change the permissions as below

#chown root:sugroup kill_it
#chmod 4510 kill_it

This script will run as root taking an argument.

Now you can pass on the pids as the arguments to this and kill the users.

Do you think this helps you for the timebeing?.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Deshpande Prashant
Honored Contributor

Re: Can you help me with this script?

Hi
Besides using SUDO you can also try using restriced SAM option.
Create a custom application in sam with your script and allow only required users to run only this application. While creating the application you can specify that the script need to run as root.

Thanks
Prashant Deshpande.
Take it as it comes.