Score:2

allowing all users to execute kill command on kubuntu 20.04LTS

us flag

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?

Nmath avatar
ng flag
All users *can* use the `kill` command. Can you be more specific and give some examples of the actual problems you are experiencing?
cv flag
`kill` is located in `/bin/kill` not `/usr/bin/kill`. Giving anyone possibility to kill any process is from security reasons a bad idea. Maybe allow only specific users or group.
vanadium avatar
cn flag
@Mateusz in a "unified" system, `/bin` is symlinked to `usr/bin` so that is as expected.
Cesar Daniel Lopez avatar
us flag
I have some machines with kubuntu 20lts, everyday when the machine start and the user's login, smb4k mount shares. But sometimes some shadows didn't mount because mountheper hungs. I need to allow all users to execute the kill command in a bash script to remote them All shares My /etc/sudoers is ALL ALL=NOPASSWD: /use/bin/kill But it doesn't work... -bash: kill: (1709) - operación no permitida The process is owned by root... What I'm doing wrong?
cv flag
@vanadium you're right. I didn't realize it's now a symlink. My Kubuntu 20.04 was upgraded from previous version and it still has separated `/bin` and `/usr/bin`
Cesar Daniel Lopez avatar
us flag
Wheris kill... in usr bin... Please help, I can't find the problem
hr flag
Note that when you run `kill` in a terminal, you're likely getting your shell's builtin `kill` command, rather than an external executable `/bin/kill` or `/usr/bin/kill`. When you run `sudo kill` you **will** get the external command.
Score:4
cn flag

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?

Cesar Daniel Lopez avatar
us flag
Thanks it's true, this is the error
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.