Permalink
Browse files

Improve 'deny' tool: no need to save executable bits state.

  • Loading branch information...
1 parent 312b3e2 commit 52be4923a2d9b4220f7f93e5dba302d28a855bcd @FooBarWidget FooBarWidget committed Dec 9, 2012
Showing with 2 additions and 7 deletions.
  1. +2 −7 deny
View
9 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
@@ -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.