user1
runs sudo -u user2 SomeCommand
. I want SomeCommand
to be able to access the files of user1
(or just a specific directory or even a single file, if that's easier), without giving access to user2
(a shared user everyone uses for running that command) in general. Are there any ways to achieve that?
Asked
Active
Viewed 90 times
2

Tgr
- 2,780
1 Answers
3
You have suggested 2 ideas in you question, so two solutions
setfacl
: to set file permissions. You can use this to set different file permissions for each user/group. see What are the different ways to set file permissions etc on gnu/linuxsudo --group user2
orsudo --user user2 --group user1
: to give access to all files, but you will have to add group write (edit umask), and ensure that default group is personal group.

ctrl-alt-delor
- 27,993