I would like to grant sudo privileges to a user but only on a specific path. For example:
user@domain $> sudo touch /etc/test/directory/samplefile
where that user doesn't have permissions to the
/etc/test/directory path which doesn't belong to the user, and I don't want to open the permissions more, I don't want to make the user part of the directory's group because that would give the user permissions to other directories as well.
So far I've tried to add this in the /etc/sudoers file:
user ALL:/etc/test/directory/=(ALL) NOPASSWD: ALL
but that syntax is not right according to visudo.
any ideas on how to do this approach?