I try to kill a service as a other user. I login as a user "usernoroot" and kill a service of a root user "userroot"!
Therefore I have a killscript.sh in the folder of "usernoroot" like:
#!/bin/sh kill -9 $1
and make this script executable:
chown root:root /home/usernoroot/killscript.sh chmod 755 /home/usernoroot/killscript.sh
Now I try to run
./killscript.sh <pid> but getting:
./killscript.sh: 2: kill: Operation not permitted
What can I do to run this script successfully?
I have installed sudo:
apt-get install sudo
add my user to group sudo
adduser usernoroot sudo
and add the script "killscript.sh to the sudoers
nano /etc/sudoers usernoroot ALL=(ALL) NOPASSWD: /home/usernoroot/killscript.sh
Now I can execute
./killscript.sh 222 to quit the process with the id 222 without any PW.