switchuser

Function switchuser 

Source
pub fn switchuser(
    ruid: u32,
    euid: u32,
    suid: u32,
    rgid: u32,
    egid: u32,
    sgid: u32,
) -> RvResult<()>
Expand description

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

§Examples

use rivia::prelude::*;

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

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