Lets say in my Debian PC have 2 users called cat and dog.

I want to use sudo setup to give dog's privileges to cat. So cat can do what dogs do.

I'm new to sudo stuff but I tried below config. It gives below error when cat trying to access dog's file.


cat ALL=(dog) ALL


Sorry, user cat is not allowed to execute '/usr/bin/vim /home/dog/test.txt' as root on debian.

test.txt file is own by dog and permissions are rw-r--r--

Can someone help...

  • Show the command for the error. – ctrl-alt-delor Jun 29 '16 at 7:39

Just figured out the problem.

When you giving privileges from other then the root user, then you need to specify user at the sudo command.

See below example:

This command run by cat and it works.

sudo -u dog vim /home/dog/test.txt

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.