I want to run pkill like below.
sudo pkill -u 11002
I cannot give sudo password multiple times, so I want to run pkill without sudo user. For this i copied pkill to home as named bkill, and then i have run the following command.
sudo setcap "cap_kill+epi" /home/rajesh/bkill
This will give kill capabilities to this binary. But whenever i run i am getting following message.
/home/rajesh/bkill -u 11002 result: 31270
I check running processes of that user using below command.
ps -u 11002
PID TTY TIME CMD 340 pts/26 00:00:00 ncserver
This is showing process pid 340 is still running. I assumed cap_kill is not working.
So I tried a different approach. I have given sudo access using below commands.
sudo chown root /home/rajesh/bkill sudo chmod u+s /home/rajesh/bkill
Even this way also not working.
Can anybody help me to resolve this??