Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/seteuid.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/seteuid.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/seteuid.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/seteuid.html on line 8
Set the effective user ID
#include <unistd.h>
int seteuid( uid_t uid );
- uid
- The effective user ID that you want to use for the process.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The seteuid() function lets the calling process set the
effective user ID, based on the following:
- If the process is the superuser, the seteuid() function
sets the effective user ID to uid.
- If the process isn't the superuser, and uid is equal
to the real user ID or saved set-user ID, seteuid() sets
the effective user ID to uid.
The real and saved user IDs aren't changed.
|
If a set-UID process sets its effective user ID to its real user ID,
it can still set its effective user ID back to the saved set-UID. |
The “superuser” is defined as any process with an effective
user ID of 0, or an effective user ID of root.
- 0
- Success.
- -1
- An error occurred
(errno
is set).
- EINVAL
- The value of uid is out of range.
- EPERM
- The process isn't the superuser, and uid doesn't
match the real user ID or the saved set-user ID.
/*
* This process sets its effective userid to 0 (root).
*/
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
int main( void )
{
uid_t oeuid;
oeuid = geteuid();
if( seteuid( 0 ) == -1 ) {
perror( "seteuid" );
return EXIT_FAILURE;
}
printf( "effective userid now 0, was %d\n",
oeuid );
return EXIT_SUCCESS;
}
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
errno,
geteuid(),
setegid(),
setuid(),
setgid()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/seteuid.html on line 195
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/seteuid.html on line 195