[][src]Function users::switch::set_both_uid

pub fn set_both_uid(ruid: uid_t, euid: uid_t) -> Result<()>

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

Typically, trying to switch to anyone other than the user already running the process requires root privileges.

libc functions used

Errors

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

Examples

use users::switch::set_both_uid;

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