2

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?

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/linux
  • sudo --group user2 or sudo --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.

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.