script-files-permissions-reset 554 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env bash
  2. # Smartly change permissions on selected directories
  3. # Copyright 2021-2025 Bryan C. Roessler
  4. # Licensed under the Apache License, Version 2.0
  5. p="${BASH_SOURCE[0]%/*}"; [[ -r $p/script-functions ]] && . "$p"/script-functions || exit 1
  6. is_root
  7. [[ $# -eq 0 ]] && DIRS=("/mnt/data") || DIRS=("$@")
  8. ask_ok "Reset permissions on ${DIRS[*]}?"
  9. if ! chgrp smbgrp -R "${DIRS[@]}"; then
  10. echo "Failed to change group ownership" >&2
  11. exit 1
  12. fi
  13. if ! chmod 6775 -R "${DIRS[@]}"; then
  14. echo "Failed to change permissions" >&2
  15. exit 1
  16. fi
  17. exit 0