sseettuuiidd() -- System Call (libc)

Set user identifier
#iinncclluuddee <uunniissttdd.hh>
iinntt sseettuuiidd(_i_d)
iinntt _i_d;

The _u_s_e_r _i_d_e_n_t_i_f_i_e_r  is the number that identifies the  user who ``owns'' a
given file.  The suite of users is defined in file /eettcc/ppaasssswwdd. When a file
is  executable, the  executing process  inherits  its user  identifier (and
thus, its  user-level permissions)  from the file  where it lives  on disk.
The user identifier comes in three forms:

rreeaall This is the identifier of the user who is running the process.

eeffffeeccttiivvee
     This is  the user identifier that determines the  access rights of the
     process.   These  rights  are the  same  as  those  of  the real  user
     identifier unless  they have  been altered  by executing a  file whose
     sseettuuiidd bit is set.

ssaavveedd eeffffeeccttiivvee
     This permits  a process to  step back and  forth between its  real and
     effective  user identifiers.   If you  return  from an  effective user
     identifier to  your real one, the previously effective  id is saved so
     you can revert to it if need be.

The  system  call sseettuuiidd()  lets  you  alter the  real  and effective  user
identifiers of the calling process to the user identifier _u_i_d. The behavior
of sseettuuiidd() varies depending upon the following:

11. If the effective user identifier is that of the superuser, sseettuuiidd() sets
   the real, effective, and saved effective user identifiers to _u_i_d.

22. If  the real  user identifier  is  the same  as _u_i_d,  sseettuuiidd() sets  the
   effective user identifier to _u_i_d.

33. If the saved effective user identifier is same as _u_i_d, sseettuuiidd() sets the
   effective user identifier to _u_i_d.

To sseettuuiidd an existing executable file, use the command cchhmmoodd.

_S_e_e _A_l_s_o
cchhmmoodd, eexxeeccuuttiioonn, ggeettuuiidd(), lliibbcc, llooggiinn, sseettggiidd(), uunniissttdd.hh
POSIX Standard, section 4.2.2

_D_i_a_g_n_o_s_t_i_c_s
sseettuuiidd() returns zero on success, or -1 on failure.

_N_o_t_e_s
For more information on the user id, see the Lexicon entry for eexxeeccuuttiioonn.
