Skip to content

Instantly share code, notes, and snippets.

@rdark
Created April 23, 2014 13:14
Show Gist options
  • Save rdark/11214760 to your computer and use it in GitHub Desktop.
Save rdark/11214760 to your computer and use it in GitHub Desktop.
Process.fork do
# drop privileges to uid/gid
Process.initgroups(u.name, gid)
Process::UID.change_privilege(u.uid)
Process::GID.change_privilege(gid) # HERE we have Errno::EPERM
puts "In BLOCK with uid: #{u.uid} and group #{gid}"
# Invoke the caller's block of code.
block.call #(user)
end
util.rb:54:in `change_privilege': Operation not permitted (Errno::EPERM)
from util.rb:54:in `block in blk_as_user'
from util.rb:49:in `fork'
from util.rb:49:in `blk_as_user'
from config.rb:288:in `write_rpmmacros'
from util.rb:294:in `base_setup'
from cli.rb:262:in `build_manager'
from cli.rb:97:in `run'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment