Operating System - HP-UX
1833874 Members
2425 Online
110063 Solutions
New Discussion

Re: use root connection in a Shell script

 
KOGOE
Advisor

use root connection in a Shell script

I've develop a posix shell script that
kill -9 some users processes; the problem I face on is that I should allow some users who are not system administrator ( are not supposed to logon as root ) to run this script; then I think off using the "SU -" in the beginning of script the problem is that I don't know how to pass the password (unclearly so that no one could edit the script and pick the pass !)
Thank U
7 REPLIES 7
RAC_1
Honored Contributor

Re: use root connection in a Shell script

First, do not use -9 on processes. It is not good. I follow following.

kill -15
kill -1
kill -2
kill -3
kill -11
and last kill -9

Also, have you heard about sudo? It comes with all logging and perfect such taks.
There is no substitute to HARDWORK
Peter Godron
Honored Contributor

Re: use root connection in a Shell script

KOGOE
Advisor

Re: use root connection in a Shell script

I tried to download sudo but the version I have found is for HP-UX 11i v1 PA-RISC;I tried to install it even but it aborted;
My system run is : HP-UX B.11.11 U 9000/800
could some one help find where to download the suitable depot of sudo for my system ?
Thank U


Victor BERRIDGE
Honored Contributor

Re: use root connection in a Shell script

Seems to be the good depot file...
So perhaps the file you got is corrupted....
(happens with ftp sometimes...)

All the best
Victor
Carlos Roberto Schimidt
Regular Advisor

Re: use root connection in a Shell script

Hi,

HP-UX 11.11 is the same 11i v1.

See "HP-UX Internet Express for HP-UX 11i v1" who have sudo for install.

http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXIEXP1111

Schimidt
KOGOE
Advisor

Re: use root connection in a Shell script

I've download sudo as you indicate me, and I install it, but I have some error while configurating the sudoers file with the command visudo; I have define in the begining of sudoers file this lines :

# Host alias specification
Host_Alias TRANS = 10.10.10.3
# User alias specification
User_Alias ETUDE = jb
# Cmnd alias specification
Cmnd_Alias KILL = /usr/sbin/debloc

But while exiting I have the following Warnings :
Warning: undeclared Host_Alias `TRANS' referenced near line 9
>>> sudoers file: syntax error, line 8 <<<
Warning: undeclared Host_Alias `ETUDE' referenced near line 11
>>> sudoers file: syntax error, line 10 <<<
Warning: undeclared Host_Alias `KILL' referenced near line 13

What may I do ?
Thanks
KOGOE
Advisor

Re: use root connection in a Shell script

I've download sudo but I have some problem
with sudoers; I've edit sudoers by visudo and enter aliases :
line 8 # Host alias specification
line 9 Host_Alias TRANS = 10.10.10.3
...
But the problem is that I've the following error :
Warning: undeclared Host_Alias `TRANS' referenced near line 9
>>> sudoers file: syntax error, line 8 <<<
I dont know the raison of that error; could someone help me please!
Thank U in advance