Archive for March 2nd, 2013
If you have a Synology where multiple users access files, but frequently moves files around as the admin user, you’ve no doubt noticed that permissions can frequently get messed up, where regular users won’t be able to delete files created by the admin user, and so on. This can be especially prevalent when using the “user homes” feature.
(UPDATE: A reader has shared a new approach, please find it here: ACL fix for Synology DiskStations)
You could use file manager as the admin user to fix permissions by hand, but there’s an easier way.
This quick little script, when run as a cron task, will traverse the user home directories, resetting permissions automatically. It’s especially handy.This only acts on user home directories, and not any other shares.
This was done on a DS211j running DSM-4.2 BETA.
So, here’s the script:
HOMES=&quot;/volume1/homes&quot; cd $HOMES for x in *; do chown -R $x $x; done
Change HOMES to reflect where your user home is.
So, first go in and upload it somewhere on your DiskStation where you like it. In this case, I’m uploading it to admin’s user home.
Now, right-click on it and select Properties, and set it as follows (that’s
chmod 0700 for those of you paying attention)
Now, to simply set it as a scheduled task. Open Control Panel > Task Scheduler and click Create > User Defined Script.
Set up the task as follows:
Under the general tab, use something descriptive for the task name, and run as root. Make sure enabled is checked.
Enter the full path to your script (the provided is typical, but yours may differ — use SSH to help you locate the file if unsure)
For the schedule tab:
I have mine set to run hourly. Granted, I don’t update my files that often, but it helps to make sure permissions are set correctly and make sure they’re never wrong for very long.
And then click Ok. This should show:
And that’s it. Your home permissions will be fixed automatically from now on.
Questions, comments, or feedback on the above? Please leave it in the comment section below. Thank you!