module Process::Daemon::Privileges
Provides functions for changing the current user.
Public Class Methods
change_user(user)
click to toggle source
Set the user of the current process. Supply either a user ID or a user name.
# File lib/process/daemon/privileges.rb, line 29 def self.change_user(user) if user.kind_of?(String) user = Etc.getpwnam(user).uid end Process::Sys.setuid(user) end
current_user()
click to toggle source
Get the user of the current process. Returns the user name.
# File lib/process/daemon/privileges.rb, line 38 def self.current_user uid = Process::Sys.getuid Etc.getpwuid(uid).name end