UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2007-08-19 01:07 PM

zhn636
Member
Registered: 2007-04-24
Posts: 146

Re: user ID

When I read the APUE book,I have a doubt,I want to know what is the set-user-ID?and what are the differences between the effective user ID?

Offline

#2 2007-08-19 05:34 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,826
Website

Re: user ID

"Set user ID" usually refers to the SUID file permission bit on an executable file...
When a file with that bit set is executed, then it is run with its effective UID set to
whoever owns the file...  This is often used to to allow unprivileged users to do
certain things that require root privilege, by making the executable file owned by
root and setting the SUID bit on it...  (This has also historically been the source of
many local privilege escalation exploits, due to security holes in those setuid apps...)

Offline

#3 2007-08-20 05:45 AM

zhn636
Member
Registered: 2007-04-24
Posts: 146

Re: user ID

and how I can set a setuid bit of a file?
   whether the real user Id of a process is the same as the effective Id ?
   are the user Id of a procee is same as the user Id of a file?
   what are differences  between them?

Offline

#4 2007-08-20 11:32 AM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,826
Website

Re: user ID

and how I can set a setuid bit of a file?

Via the "chmod" command from a command-line, or via the chmod() function from
within an app...  Type "man 1 chmod" and "man 2 chmod" for full info...

whether the real user Id of a process is the same as the effective Id ?

Um, no, not necessarily...  Specifically in the case of running a setuid app, the
effective UID will be the owner of the executable file, while the real UID will be that
of the real user running the app...

are the user Id of a procee is same as the user Id of a file?
what are differences between them?

What?  No idea what you're even asking here...

Offline

#5 2007-08-21 01:53 AM

zhn636
Member
Registered: 2007-04-24
Posts: 146

Re: user ID

oh,sorry,the third question I want to ask is the user ID of process whether is the same as the user ID of the File

Offline

#6 2007-08-21 11:59 AM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,826
Website

Re: user ID

But, that question doesn't make any sense to me...  Do you mean when running
a setuid executable file?  If so, then the effective UID of the process will be the
owner of the file...  As I've already mentioned...  So, I still don't know if you're
asking something completely different...

Offline

#7 2007-08-22 04:37 AM

zhn636
Member
Registered: 2007-04-24
Posts: 146

Re: user ID

oh,I have a doubt in the saved set-user-id ,I do not know what is the meaning of this ID,why we need this saved set-user-id? and when we need to use this ID?whether the saved user-user-id the same as the set-user-id ?
  Is the set-user-id  the synonym of the saved set-user-id?

Offline

#8 2007-08-22 01:31 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,826
Website

Re: user ID

No...  Set-user-ID applies only to files...  Real UID, effective UID, and saved UID
apply to running processes...  Now, if you run an exectuable with the set-user-ID bit
set, then the resulting running process will start off with a real UID of the real user
running it, and an effective and saved UID of the owner of the executable file...  If
the process then calls setuid() or seteuid() to change their effective UID, they can
still get back their original privileges again thanks to the saved UID...

Offline

Board footer

Powered by FluxBB