0

I was interested in learning how to use Linux, but while studying SUID and GUID I have had trouble understanding exactly what it does. Now I know that it grants permissions of the user or group, but how exactly ?

Here's the thing I don't quite get; if a file has SUID bit set, does that mean another user that's neither in the group nor the original owner has now the same permissions on that file as the owner of the file. For example a file has these permissions set:

-rws-rw-r 

Does that mean that a user that's part of the other category now has owner-level privileges for that file?

Same thing for GUID: if the s bit is set, does everyone have the the same permissions as the group?

Rwx-rws-r 

Does that mean that all -other users have the same permissions as the group (read and write).

Also, what's the purpose of such a feature and why is the x (execute) permission always omitted when I see the s bit set?

0

The SUID bit let's a user execute the file as it the user was the owner. This has implication for other files that the executed file can access: The executed file can access all files the owner could access (but maybe not normally the user executing the file).

See some examples and more details e.g. here

| improve this answer | |
  • So does that mean if a file had permission settings set to 4770 it would allow a user in the -Other category to execute/read/write on the files as if it's the owner, even though the owner permissions are set to zero ? – Asimov Mar 7 at 19:39
  • Yes, with SUID the permissions of the owner of the file determine what the executed file can access, not the permissions of the user. – ThinkHard Mar 8 at 9:11
  • Thanks I get it now. Appreciate it. – Asimov Mar 9 at 19:06

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.