Operating System - HP-UX
1751888 Members
5213 Online
108783 Solutions
New Discussion юеВ

Re: kill: <pid> : Permission denied.

 
LawrenceLow
Advisor

kill: <pid> : Permission denied.

Hi there,

We do have a script for our internal IT support team to terminate user's process (pid). It works previously and this morning our new SA delete the script accidentally. Unfortunately it doesn't work anymore after we do the restoration.

/user/livebgi% ll killer
-rwxrwxrwx 1 lowsyhtg informix 263 Jan 13 08:19 killer
/user/livebgi% more killer
#!/bin/sh
echo You are about to kill a user process, enter user to kill? Who is that lucky person?
read usr_name
a=`ps -ef|grep "$usr_name"|grep -v grep|grep -v ps|cut -c10-14|sort -r`

echo Killing the process belongs to user $usr_name:$a
kill -9 $a

#!/bin/csh
/user/livebgi%
/user/livebgi% finger | grep ycchong
ycchong Chong Yew Choun *t9e 4:14 Thu 08:37 Marketing
/user/livebgi% killer
You are about to kill a user process, enter user to kill? Who is that lucky person?
ycchong
Killing the process belongs to user ycchong:19800 19797 18350 18088
kill: 19800: Permission denied.
kill: 19797: Permission denied.
kill: 18350: Permission denied.
kill: 18088: Permission denied.
/user/livebgi%




Please assist!!
18 REPLIES 18
Jupinder Bedi
Respected Contributor

Re: kill: <pid> : Permission denied.

change the ownership of the script to root by using chown command and try ... best of luck
All things excellent are as difficult as they are rare
LawrenceLow
Advisor

Re: kill: <pid> : Permission denied.

Jupinder,

/user/livebgi % ll killer
-rwxrwxrwx 1 root sys 263 Jan 13 08:19 killer
/user/livebgi % killer
You are about to kill a user process, enter user to kill? Who is that lucky person?
lowsyhth
Killing the process belongs to user lowsyhth: 4176
kill: 4176: Permission denied.
/user/livebgi %


still remain the same....

Horia Chirculescu
Honored Contributor

Re: kill: <pid> : Permission denied.

Lawrence,

I suppose that you run this script as root, right?

Horia.
Best regards from Romania,
Horia.
Jupinder Bedi
Respected Contributor

Re: kill: <pid> : Permission denied.

are you using the root user normal user to kill the processes. if you are using normail user you cant kill the processes unless or until you have root permission otherwise you need to use the sudo

# ./killer
$ sudo ./killer
All things excellent are as difficult as they are rare
Vishu
Trusted Contributor

Re: kill: <pid> : Permission denied.

Hi,

you must be root user to kill the process. so, try login with root and killing those processes.

Thanks
LawrenceLow
Advisor

Re: kill: <pid> : Permission denied.

Nope, previously we can to use Informix user to kill the process. In fact, the script is mainly for our internal IT support team to kill the normal user's process.
Horia Chirculescu
Honored Contributor

Re: kill: <pid> : Permission denied.

You can do it 2 ways:

1. modify your script tu use sudo in order to send the kill command

or

2. modify your "normal" user setting user id=0 in /etc/passwd

Maybe you used the second 'solution'

Best regards
Horia.
Best regards from Romania,
Horia.
Vishu
Trusted Contributor

Re: kill: <pid> : Permission denied.

Lawrance,

one user cannot kill any process initiated by the other user or you have to be super user for that.

Pete Randall
Outstanding Contributor

Re: kill: <pid> : Permission denied.

Try setting it up like this:

-rwsr-xr-- 1 root informix 1280 Feb 22 2005 killer


Pete

Pete