Question regarding SUID & GUID

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?

1 Answer

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

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like