module Process::UID
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.
Public Class Methods
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/process.rbs, line 2209
def self.change_privilege: (Integer user) -> Integer
Change the current process’s real and effective user ID to that specified by user. 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]
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/process.rbs, line 2221
def self.eid: () -> Integer
Returns the effective user ID for the current process.
Process.euid # => 501
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/process.rbs, line 2305
def self.eid=: (Integer user) -> Integer
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/process.rbs, line 2233
def self.from_name: (String name) -> Integer
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)
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/process.rbs, line 2248
def self.grant_privilege: (Integer user) -> Integer
Set the effective user ID, and if possible, the saved user ID of the process to the given user. 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]
() → Integer
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/process.rbs, line 2261
def self.re_exchange: () -> Integer
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]
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/process.rbs, line 2270
def self.re_exchangeable?: () -> bool
Returns true if the real and effective user IDs of a process may be exchanged on the current platform.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/process.rbs, line 2282
def self.rid: () -> Integer
Returns the (real) user ID of the current process.
Process.uid # => 1000
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/process.rbs, line 2290
def self.sid_available?: () -> bool
Returns true if the current platform has saved user ID functionality.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/process.rbs, line 2302
def self.switch: () -> Integer
| [T] () { () -> T } -> T
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.