2

I want to be able to have a r,w,x type permission given to specific processes and not to users. Any document I find shows that processes get the same permissions as the user calling it, but I want different processes to have different permissions even on the same user.

Is there a way to achieve this?

  • You can make your processes setuid or setgid to another user or group. However, please note that you are working against the very basic principles of the operating system. – AlexP Nov 23 '16 at 11:38
  • @AlexP The following link shows that that won't work though. unix.stackexchange.com/questions/206289/… – CuriousKimchi Nov 23 '16 at 11:40
  • @AlexP And even if it did work, I want a process to be able to access fileA but not fileB for the same user. If I change the setuid for the process, even if a user created fileA, he may not be able to access it anymore using that said process. – CuriousKimchi Nov 23 '16 at 11:42
  • Setuid and setgid bits absolutely do work. The link provided discusses a well known behavior of GNU/Linux systems. – AlexP Nov 23 '16 at 11:43
  • 1
    Access rights are determined by the effective user id and effective group id of a process. Normally a process gets its EUID and EGID from the invoking process, but it may also take them from the owner or group of the image which is exec'd, if the appropriate bits are set in the access mode of the image. Use man 7 credentials for more details. – AlexP Nov 23 '16 at 11:47

Your Answer

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

Browse other questions tagged or ask your own question.