4

In simple words users will get file owner’s permissions as well as owner UID and GID when executing a file/program.It will not change the file's owner.

If you imposed in a program: rwsrwxr-- or rwxr--rwx

What is the difference if I set the SUID permission (for owners) or World permission (other)? in both cases the user can run the program?

bilz
  • 41
  • 1

3 Answers3

2

If you have rwxr--rwx permissions you will be able to run the program as "other", but in case this program will need permission to access, for example, a file for which you don't have a permission - it will fail.

rwsrwxr-- won't even let you run the command as "other" in the first place

So, you need your own x permission to even launch the program, but you also need SUID if you want the program to assume privileges of its owner.

Btw, if you want to experiment with SUIDs note that SUID is disabled (does not have any effect) by default on bash scripts

Valera Maniuk
  • 1,627
  • 3
  • 11
  • 14
0

Whether or not a user is able to run a program depends on if it has the executable permission or not. Yes setting suid bit does not alter the owner.

Now coming to your question, setting suid for world does not make any difference as any user has its own permission when running that program, thus suid bit for world not making any sense while setting suid bit for owner would allow any user who is able to run it to run with the permissions as that of owner. So to summarize running the program is not dependent on suid bit and rather depends on x (executable) perm.

rusia.inc
  • 891
  • 7
  • 10
0

first, you should ask like this question in this community.

Next, according to this doc by setting suid you would run file by onwer permission.

for example passwd command will read and write in /etc/shadow file that has rw-r----- permission, but you could invoke that command, why? the reason hidden in suid issue.

because by suid bit functionality_ you run app as owner file user permission not other user permission

Hossein Vatani
  • 1,381
  • 14
  • 26