I am relatively new to the concepts mentioned in the question and reading about them from different sources only makes them more confusing. So this is what I understood so far:
When we are given permissions for a file, they look like this:
-rwsr-xr-- 1 user1 users 190 Oct 12 14:23 file.bin
We assume that a user user2
who is in the group users
tries to execute file.bin
. If the setuid bit were not set, this would mean that both the RUID and EUID of file.bin
were equal to the UID of user2
. But since the setuid bit is set, this means that the RUID is now equal to the UID of user2
, while EUID is the UID of the owner of the file, user1
.
My questions are:
- What is the difference between the owner of the file and
root
? Doesroot
have the same permissions as the owner? Or would we need a separate entry in the permissions list forroot
? - Difference between RUID and EUID?
- As I understand it the RUID and EUID are applied only to processes. If that is the case, why do they have the value of user id's?
- If RUID is the user who creates the process, and EUID is the user who is currently running the process, then the first sentence of the first answer in this question does not make any sense to me.
- Did I understand correctly what the setuid bit does?