FAQ 24: Restoring Share Permissions to Default Settings
DSM 6 only
This FAQ/How-To is for those cases when the different applications in use on a Synology NAS have interfered with PMS operations so much that trying to sort out the root cause has become impossible.
It is in these cases, the best solution is to forcibly set them to a known base permission level.
Here is how to do it.
- Control Panel - Scheduled Tasks
- Create a “User defined Script”
- DO NOT “enable” it (It is enabled by default). You want full manual control.
- In the Task Settings tab, paste the script below (copy/paste from the browser) exactly as I have provided
- Save (OK) it.
- Now “Edit” it again → Task Settings.
- Edit the line:
for D in "/volume1/Animated"
, replacing my share pathnames with your pathnames. Multiple quoted paths may be listed on that line, separated by a space. The names are case-sensitive so please to be exact. - The script runs silently but you can opt to have it email you the output (in the other settings).
- When happy with your edits, Save it again (OK).
- The task is now ready to execute.
- Run the task.
- Review and re-add permissions to the share(s) using Control Panel - Shared Folders.
It is advised Operate on one share at a time until you are certain you understand what follow-on steps are needed.
After running the script, any special permissions which were previously granted to the listed shares will have been removed.
The default permissions assigned are:
- The share owner (you?) will have full Read/Write access
- Everyone else will have Read-Only.
- Shared Folders or File Station can now be used to add/remove permissions as you deem appropriate.
A. Preparation of the script - Creating
B. Pasting in the actual script from below +
C. Running the script to set the permissions.
The “Script” for Task Settings
#
# This script will reset and assert permissions in the each of the listed directories
# in this "for" loop. DO NOT assert permissions on any Synology/system-reserved folders. This could render your data inaccessible.
# Which shares are we going to work on
for D in "/volume1/Animated"
do
# Do this only if the name ($D) is a directory (full folder path)
if [ -d "$D" ]; then
# Revoke all previous permissions to a sane value
find "$D" -type d -exec chmod 755 {} \;
find "$D" -type f -exec chmod 644 {} \;
# Now assert Synology ACLs so the current file owner has control
find "$D" -type d -exec synoacltool -add {} 'owner:*:allow:rwxpdDaAaRWcCo:fd--' \;
# Grant Read-only to everyone else
find "$D" -type d -exec synoacltool -add {} 'everyone:*:allow:r-x------R-c-o:fd--' \;
fi
done
Ask if questions prior to use.