Skip to content

Instantly share code, notes, and snippets.

@ice799
Created April 9, 2009 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ice799/4acbe14306e86001e193 to your computer and use it in GitHub Desktop.
Save ice799/4acbe14306e86001e193 to your computer and use it in GitHub Desktop.
def write_file
begin
File.open("/test", "w+") do |f|
f.write("hello!\n")
f.close
end
puts "wrote test file"
rescue Errno::EACCES
puts "could not write test file"
end
end
puts "ok, set uid to nobody"
Process.euid = 65534
puts "going to try to write to / now..."
write_file
puts "restoring back to root"
Process.euid = 0
puts "now writing file"
write_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment