nu_utils::filesystem::users

Function get_user_groups

Source
pub fn get_user_groups(username: &str, gid: Gid) -> Option<Vec<Gid>>
Expand description

Returns groups for a provided user name and primary group id.

§libc functions used

§Examples

use users::get_user_groups;

for group in get_user_groups("stevedore", 1001).expect("Error looking up groups") {
    println!("User is a member of group #{group}");
}