The getuid(2) and geteuid(2) Functions

When the id(1) command runs, it needs to find out what user and group it is running under. This is accomplished by the getuid(2) and geteuid(2) functions. The function synopsis is as follows:

#include <unistd.h>
#include <sys/types.h>

uid_t getuid(void);

uid_t geteuid(void);

The getuid(2) function returns the real uid number it is operating under, while geteuid(2) returns the effective uid. There are no errors returned; these functions always succeed.

The geteuid(2) function returns the effective uid that is currently in force. UNIX processes can arrange to become other uid values temporarily through functions such as setuid(2). For security reasons, setuid(2) functionality is severely restricted. The differences between a real user ID and an effective user ID will be discussed shortly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.238.70