allowing all users to execute kill command on kubuntu 20.04LTS

on kubuntu 20lts

sudo sh -c ' echo "ALL  ALL=(NOPASSWD: /usr/bin/kill" >> /etc/sudoers'

I have some machines with Kubuntu 20.04 LTS, everyday when the machines start, and the users login, smb4k mounts shares. But sometimes some shares dont mount because mounthelper hangs up. I need to allow all users to execute the kill command in a bash script to remote them All the shares.

But it doesn't work... -bash: kill: (1709) - operation not permitted The process is owned by root What I'm doing wrong?

7

1 Answer

The only thing you are currently doing wrong is assuming that there is no need anymore to precede the command with sudo.

All users by default are already allowed to use the kill command. However, users only can kill processes they owned. To kill a process owned by root, users must precede the kill command by sudo to have it run with elevated permissions.

The change you performed to /etc/sudoers will allow them to execute sudo kill without having to enter a password. See Execute sudo without Password?

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like