[][src]Function users::switch::set_both_gid

pub fn set_both_gid(rgid: gid_t, egid: gid_t) -> Result<()>

Sets both the current group and the effective group for the running process to the ones with the given group IDs.

Typically, trying to switch to any group other than the group already running the process requires root privileges.

libc functions used

Errors

This function will return Err when an I/O error occurs during the setregid call.

Examples

use users::switch::set_both_gid;

set_both_gid(1001, 1001);
// current user ID and effective group ID are 1001