Re[2]: setuid funciton

Cihan Kömeçoğlu <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <[email protected]>
I understand. Thanks for your answer
I try this code under Freebsd 6.2
and dont give me this output

Wednesday, December 26, 2007, 5:28:08 AM, you wrote:

> Cihan Kömeçoľlu wrote:

>> Hello everybody
>> 
>> I have written simple code about usage of setuid. this program file
>> set-user-id bit is on and this process after exec when I execute this
>> program, effective user id and saved-user-id bit will be
>> program-file's user id. this correct?
>> 
>> But the last output when I set uid to 80(www) ,effective user id
>> wasn't 80. Why not? saved set user id is still 80? What is the
>> problem?
>> 
>> 
>> I compiled below code with gcc and I set-user-id bit and change own
>> file with this command

> [snip]

> It works for me; I get:

> Real UID        = 1001
> Effective UID   = 80
> Real UID        = 1001
> Effective UID   = 1001
> Real UID        = 1001
> Effective UID   = 80

> This is with a 2.6.17.13 kernel, compiled from stock sources (no
> vendor patches).

> If you are using a kernel with additional security features (e.g. 
> SELinux, AppArmor etc), it may impose additional restrictions on
> setuid(). You could try using setreuid() to swap the real and
> effective UIDs, rather than relying upon the saved UID.




-- 
Cihan Kömeçoðlu,
EnderUNIX SDT                           mailto:[email protected]

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.