lib/net/server.rb
def drop_root_privileges(user_name, group_name, working_directory)
      # drop root privileges
      if Process::Sys.getuid==0
        user = Etc::getpwnam(user_name)
        group = Etc::getgrnam(group_name)
        Dir.chdir(user.dir)
        Dir.chdir(working_directory) if not working_directory.nil?
        Process::GID.change_privilege(group.gid)
        Process::UID.change_privilege(user.uid)
      end
    end
#
# This method drops the process's root privileges for security reasons.
#
This method drops the process's root privileges for security reasons.
This method drops the process ' s root privileges for security reasons .
def drop_root_privileges(user_name, group_name, working_directory)
      if Process::Sys.getuid==0
        user = Etc::getpwnam(user_name)
        group = Etc::getgrnam(group_name)
        Dir.chdir(user.dir)
        Dir.chdir(working_directory) if not working_directory.nil?
        Process::GID.change_privilege(group.gid)
        Process::UID.change_privilege(user.uid)
      end
    end
def drop_root_privileges ( user_name , group_name , working_directory ) if Process :: Sys . getuid == 0 user = Etc :: getpwnam ( user_name ) group = Etc :: getgrnam ( group_name ) Dir . chdir ( user . dir ) Dir . chdir ( working_directory ) if not working_directory . nil? Process :: GID . change_privilege ( group . gid ) Process :: UID . change_privilege ( user . uid ) end end
This method drops the process's root privileges for security reasons.
This method drops the process ' s root privileges for security reasons .
# drop root privileges
user_name
group_name
working_directory