Function users::switch::set_current_uid [−][src]
pub fn set_current_uid(uid: uid_t) -> Result<()>
Sets the current user for the running process to the one with the given user ID.
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
setuid
call.
Examples
use users::switch::set_current_uid; set_current_uid(1001); // current user ID is 1001