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.
Config:
cat ALL=(dog) ALL
Error:
Sorry, user cat is not allowed to execute '/usr/bin/vim /home/dog/test.txt' as root on debian.
test.txt file permissions are rw-r--r--
Can someone help...
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