[][src]Function fungus::sys::user::switchuser

pub fn switchuser(
    ruid: u32,
    euid: u32,
    suid: u32,
    rgid: u32,
    egid: u32,
    sgid: u32
) -> FuResult<()>

Switches to another use by setting the real, effective and saved user and group ids.

Examples

use fungus::prelude::*;

// Switch to user 1000 but preserve root priviledeges to switch again
user::switchuser(1000, 1000, 0, 1000, 1000, 0);

// Switch to user 1000 and drop root priviledges permanantely
user::switchuser(1000, 1000, 1000, 1000, 1000, 1000);