[][src]Function users::switch::set_effective_gid

pub fn set_effective_gid(gid: gid_t) -> Result<()>

Sets the effective group for the running process to the one with the given group ID.

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 setegid call.

Examples

use users::switch::set_effective_gid;

set_effective_gid(1001);
// current effective group ID is 1001