ptg10805159
98 Files and Directories Chapter 4
File type Count Percentage
regular file 415,803 79.77 %
directory 62,197 11.93
symbolic link 40,018 8.25
character special 155 0.03
block special 47 0.01
socket 45 0.01
FIFO 0 0.00
Figure 4.4Counts and percentages of different file types
4.4 Set-User-ID and Set-Group-ID
Every process has six or moreIDs associated with it. These areshown in Figure4.5.
real user ID
real group ID who we really are
effective user ID
effective group ID used for file access permission checks
supplementary group IDs
saved set-user-ID
saved set-group-ID saved byexecfunctions
Figure 4.5 User IDs and group IDs associated with each process
•The real user ID and real group ID identify who we really are. These two fields
aretaken from our entry in the passwordfile when we log in. Normally,these
values don’t change during a login session, although thereare ways for a
superuser process to change them, which we describe in Section 8.11.
•The effective user ID, effective group ID, and supplementary group IDs
determine our file access permissions, as we describe in the next section. (We
defined supplementary group IDs in Section 1.8.)
•The saved set-user-ID and saved set-group-ID contain copies of the effective
user ID and the effective group ID, respectively,when a program is executed.
We describe the function of these two saved values when we describe the
setuidfunction in Section 8.11.
The saved IDs arerequired as of the 2001 version of POSIX.1. They wereoptional in older
versions of POSIX. An application can test for the constant_POSIX_SAVED_IDSat
compile time or can callsysconfwith the_SC_SAVED_IDSargument at runtime, to see
whether the implementation supports this feature.
Normally,the effective user ID equals the real user ID, and the effective group ID equals
the real group ID.
Every file has an owner and a group owner.The owner is specified by thest_uid
member of thestatstructure; the group owner, by thest_gidmember.