- Inheritance
The Process::UID module contains a collection of module functions which can be used to portably get, set, and switch the current process‘s real, effective, and saved user IDs.
Methods
Class
Visibility | Signature |
---|---|
public | change_privilege (p1) |
public | eid () |
public | grant_privilege (p1) |
public | re_exchange () |
public | re_exchangeable? () |
public | rid () |
public | sid_available? () |
public | switch () |
Class Method Detail
Process::UID.change_privilege(integer) => fixnum
Change the current process‘s real and effective user ID to that specified by integer. Returns the new user ID. Not available on all platforms.
[Process.uid, Process.euid] #=> [0, 0] Process::UID.change_privilege(31) #=> 31 [Process.uid, Process.euid] #=> [31, 31]
Process.euid => fixnum
Process::UID.eid => fixnum
Process::Sys.geteuid => fixnum
Returns the effective user ID for this process.
Process.euid #=> 501
Process::UID.grant_privilege(integer) => fixnum
Process::UID.eid= integer => fixnum
Set the effective user ID, and if possible, the saved user ID of the process to the given integer. Returns the new effective user ID. Not available on all platforms.
[Process.uid, Process.euid] #=> [0, 0] Process::UID.grant_privilege(31) #=> 31 [Process.uid, Process.euid] #=> [0, 31]
Process::UID.re_exchange => fixnum
Exchange real and effective user IDs and return the new effective user ID. Not available on all platforms.
[Process.uid, Process.euid] #=> [0, 31] Process::UID.re_exchange #=> 0 [Process.uid, Process.euid] #=> [31, 0]
Process::UID.re_exchangeable? => true or false
Returns true if the real and effective user IDs of a process may be exchanged on the current platform.
Process.uid => fixnum
Process::UID.rid => fixnum
Process::Sys.getuid => fixnum
Returns the (real) user ID of this process.
Process.uid #=> 501
Process::UID.sid_available? => true or false
Returns true if the current platform has saved user ID functionality.
Process::UID.switch => fixnum
Process::UID.switch {|| block} => object
Switch the effective and real user IDs of the current process. If a block is given, the user IDs will be switched back after the block is executed. Returns the new effective user ID if called without a block, and the return value of the block if one is given.