Skip to content

Commit

Permalink
Improve 'deny' tool: no need to save executable bits state.
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Dec 9, 2012
1 parent 312b3e2 commit 52be492
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions deny
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
def help
puts "Usage: permit <USERNAME> <DIR>"
puts "Usage: deny <USERNAME> <DIR>"
puts "Removes access for USERNAME to directory DIR."
exit 1
end
Expand All @@ -17,11 +17,6 @@ help if ARGV.size != 2
username, dir = ARGV
puts "cd #{dir}"
Dir.chdir(dir) do
executable_files = "/tmp/executable-files.#{$$}"
sh "find -type f -executable -print0 > #{executable_files}"
sh "find -print0 | xargs -0 -n 1000 -r setfacl -x user:#{username}"
sh "setfacl -R -x user:#{username} ."
sh "find -type d -print0 | xargs -0 -n 1000 -r setfacl -d -x user:#{username}"
sh "find -type f -print0 | xargs -0 -n 1000 -r chmod -x"
sh "cat #{executable_files} | xargs -0 -n 1000 -r chmod +x"
sh "rm -f #{executable_files}"
end

0 comments on commit 52be492

Please sign in to comment.