[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

[LI] Re: What is SUID ?



Rajesh Fowkar forced the electrons to say:
> What is this SETUID and which programs need this to be set. While installing
> why they are not SETUID by default. Can anybody put light on this ?
> 

Let us say user1 on a system wrote a program called prog which writes to a
file owned by user1, which user2 has to use. But when he runs the program, it
crashes/does not produce the desired o/p because he has no permissions to
write to the abovementioned file. So what to do?

user1, in this case sets the setuid bit "on" on prog. Then, whenever user2
runs the program, it runs effectively with the permissions of user1 (in the
other case, it ran with the permissions of user2). Then, user2 can use the
program without problems.

One example of a setuid program is the unix passwd command. As a normal user,
you cannot write to /etc/passwd, and theoretically cannot change your
password. But, since this program is run with its setuid bit on, and since it
is owned by root, for the duration of this program, you are effectively the
root of the system, and thus can update the password file.

There are many other examples - try find / -perm 4711 -o -perm 4755 to get a
list of all setuid programs on your system.

Binand

-- 
#include <stdio.h>                                   | Binand Raj S.
char *p = "#include <stdio.h>%cchar *p = %c%s%c;     | This is a self-
int main(){printf(p,10,34,p,34,10);return 0;}%c";    | printing program.
int main(){printf(p,10,34,p,34,10);return 0;}        | Try it!!
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.