SETREGID(2) System Calls Manual SETREGID(2)NAME
setregid - set real and effective group ID
SYNOPSIS
setregid(rgid, egid)
int rgid, egid;
DESCRIPTION
The real and effective group ID's of the current process are set to the arguments. Unprivileged users may change the real group ID to the
effective group ID and vice-versa; only the super-user may make other changes.
Supplying a value of -1 for either the real or effective group ID forces the system to substitute the current ID in place of the -1 parame-
ter.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
[EPERM] The current process is not the super-user and a change other than changing the effective group-id to the real group-id was
specified.
SEE ALSO getgid(2), setreuid(2), setgid(3)4.2 Berkeley Distribution May 15, 1985 SETREGID(2)
Check Out this Related Man Page
setregid(2) System Calls Manual setregid(2)Name
setregid - set real and effective group ID
Syntax
setregid(rgid, egid)
int rgid, egid;
Description
The real and effective group ID's of the current process are set to the arguments.
Supplying a value of -1 for either the real or effective group ID forces the system to substitute the current ID for the -1 parameter.
Environment
BSD
If the process is superuser, or and matches with the real group ID, the effective group ID, or the saved set-group-id (as described in ),
then the real, effective, and saved set-group-id are set to and respectively.
POSIX
SYSTEM-FIVE
When your program is compiled in POSIX or SYSTEM-FIVE mode, the following semantics apply when using the function.
If the process is the superuser, the real, effective, and saved set-group-id (as described in ) are set to and respectively.
If the process is not the superuser, but the and matches the real group ID, the effective group ID (only in SYSTEM-FIVE and BSD environ-
ment), or the saved set-group-id, then the effective ID is set to The real group ID and the saved set-group-id are left unchanged.
Return Values
Upon successful completion, a value of zero (0) is returned. Otherwise, a value of -1 is returned, and errno is set to indicate the error.
Diagnostics
[EPERM] The current process is not the superuser and the and specified does not match with the real group ID or the effective group
ID (only in SYSTEM-FIVE and BSD environment) or the saved set-group-id.
See Alsogetgid(2), setreuid(2), setgid(3)setregid(2)
Hi All,
Please help me out in fllowing problem.
I have text file which contains the data in following format.
Contents of file.txt are
setregid02
Test that setregid() fails and sets the proper errno values when a
non-root user attemps to change the real or effective... (2 Replies)