Guest User

Untitled

a guest
May 24th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. function reset_acl_ufs {
  2. find $1 -type d -exec $SUDO setfacl -r -s 'user::rwx,group::rwx,other:---,default:user::rw-,default:group::rw-,default:other:---' {} '\;'
  3. find $1 -type d -exec $SUDO chmod g+s {} '\;'
  4. find $1 -type f -o -type l -exec $SUDO setfacl -r -s 'user::rw-,group::rw-,other::---' {} '\;'
  5. }
  6.  
  7. function reset_acl {
  8. if [[ $FS = 'ufs' ]]; then
  9. reset_acl_ufs $1
  10. else
  11. reset_acl_zfs $1
  12. fi
  13. }
  14.  
  15. function reset_acl_zfs {
  16. $SUDO chmod -R A- $1
  17. $SUDO chown -R $INSTRUCTOR_USER:$INSTRUCTOR_GROUP $1
  18. find $1 -type d -exec $SUDO chmod 1770 {} '\;'
  19. find $1 -type d -exec $SUDO chmod g+s {} '\;'
  20. find $1 -type f -o -type l -exec $SUDO chmod 660 {} '\;'
  21. }
  22.  
  23. function acl_ufs_student {
  24. find $1 -type d -exec $SUDO setfacl -r -m 'default:user:$1:rw-,user:$1:rwx' {} '\;'
  25. find $1 -type f -exec $SUDO setfacl -r -m 'user:$1:rw-' {}'\;'
  26. }
  27.  
  28. function acl_zfs_student { #$1 = teamdir, $2 = user
  29. $SUDO chmod -R "A+user:$2:wpDrcaRWAC:fdi:allow" $1
  30. }
  31.  
  32. function acl_student { # $1 = teamdir, $2 = user
  33. if [[ $FS = 'zfs' ]]
  34. then
  35. acl_zfs_student $1 $2
  36. else
  37. acl_ufs_student $1 $2
  38. fi
  39. }
Add Comment
Please, Sign In to add comment