Reorganise Repositiry.
This commit is contained in:
6
OLD/check_samba_rights.sh
Executable file
6
OLD/check_samba_rights.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
(/root/bin/cleanup_samba_rights.sh <directory> <group>)
|
||||
..
|
||||
|
||||
exit 0
|
29
OLD/cleanup_samba_rights.sh
Executable file
29
OLD/cleanup_samba_rights.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
base_dir=$1
|
||||
group=$2
|
||||
|
||||
file_perm=${3:-664}
|
||||
dir_perm=${4:-2775}
|
||||
|
||||
chmod $dir_perm $base_dir
|
||||
chgrp $group $base_dir
|
||||
|
||||
while IFS='' read -r -d '' filename ; do
|
||||
|
||||
[[ -f "$filename" ]] && ( chmod $file_perm "$filename"; chgrp $group "$filename")
|
||||
[[ ! -d "$filename" ]] && continue
|
||||
|
||||
[[ "$filename" =~ .Trash ]] && continue
|
||||
[[ "$filename" = "lost+found" ]] && continue
|
||||
|
||||
chmod $dir_perm "$filename" ; chgrp $group "$filename"
|
||||
|
||||
find "$filename" ! -group $group -exec chgrp -R $group {} \;
|
||||
find "$filename" -type d ! -perm $dir_perm -exec chmod -R $dir_perm {} \;
|
||||
find "$filename" -type f ! -perm $file_perm -exec chmod -R $file_perm {} \;
|
||||
|
||||
|
||||
done < <(find $base_dir -mindepth 1 -maxdepth 1 -print0)
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user