Module: Process::UID
| Relationships & Source Files | |
| Defined in: | process.c | 
Overview
The 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.
Class Attribute Summary
- 
    
      .eid  ⇒ Integer 
    
    readonly
    mod_func
    Alias for euid. 
- 
    
      .re_exchangeable?  ⇒ Boolean 
    
    readonly
    mod_func
    Returns trueif the real and effective user IDs of a process may be exchanged on the current platform.
- 
    
      .rid  ⇒ Integer 
    
    readonly
    mod_func
    Alias for uid. 
- 
    
      .sid_available?  ⇒ Boolean 
    
    readonly
    mod_func
    Returns trueif the current platform has saved user ID functionality.
Class Method Summary
- 
    
      .change_privilege(user)  ⇒ Integer 
    
    mod_func
    Change the current process's real and effective user ID to that specified by user. 
- 
    
      .from_name(name)  ⇒ UID 
    
    mod_func
    Get the user ID by the name. 
- 
    
      .grant_privilege(user)  ⇒ Integer 
    
    mod_func
    Set the effective user ID, and if possible, the saved user ID of the process to the given user. 
- 
    
      .re_exchange  ⇒ Integer 
    
    mod_func
    Exchange real and effective user IDs and return the new effective user ID. 
- 
    
      .switch  ⇒ Integer 
    
    mod_func
    Switch the effective and real user IDs of the current process. 
Class Attribute Details
.eid ⇒ Integer (readonly, mod_func)
Alias for Process.euid.
    .re_exchangeable?  ⇒ Boolean  (readonly, mod_func)  
Returns true if the real and effective user IDs of a process may be exchanged on the current platform.
.rid ⇒ Integer (readonly, mod_func)
Alias for Process.uid.
    .sid_available?  ⇒ Boolean  (readonly, mod_func)  
Returns true if the current platform has saved user ID functionality.
Class Method Details
.change_privilege(user) ⇒ Integer (mod_func)
    .from_name(name)  ⇒ UID  (mod_func)  
Get the user ID by the name. If the user is not found, ::ArgumentError will be raised.
Process::UID.from_name("root") #=> 0
Process::UID.from_name("nosuchuser") #=> can't find user for nosuchuser (ArgumentError).re_exchange ⇒ Integer (mod_func)
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.