fix: some slight improvements
This commit is contained in:
parent
28267d39b3
commit
8e3c8a6a2f
1 changed files with 2 additions and 4 deletions
|
@ -11,7 +11,6 @@ change_owner_and_permissions() {
|
|||
|
||||
# Change owner of the directory and its contents
|
||||
chown -R "$username" "$dir"
|
||||
|
||||
}
|
||||
|
||||
iter_dirs(){
|
||||
|
@ -39,14 +38,13 @@ iter_dirs(){
|
|||
fi
|
||||
|
||||
# Set permissions to read-only for the owner and not readable by others
|
||||
#chmod -R 400 "$dir"
|
||||
# folders have to be executable to be able to read their contents
|
||||
chmod -R 500 "$dir"
|
||||
|
||||
# Check if the user exists before changing ownership and permissions
|
||||
if id "$username" &>/dev/null; then
|
||||
change_owner_and_permissions "$dir" "$username"
|
||||
echo "Changed owner and permissions of $dir to $username"
|
||||
#else
|
||||
#echo "User $username not found. Leaving $dir owned by root."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue