NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
JMehring
Feb 28, 2014Apprentice
Script to reset ACL permissions on shares
One of the problems I have been having with the ReadyNAS OS6 vesion is that there does not seem to be a way to be able to reset all the permissions and owner/group names to a share based on what I had selected in the Settings tab. Anytime I wanted to update the default ACL list or just add or remove a user it did not update and files or directories within the share. If I choose the reset option it reset everything to guest.guest wrxwrxwrx.
So I wrote a bash script yesterday to do the job since I could not find anything out there that could reliabily and recursively apply ACL changes while keeping executable permissions for files in tack. You will need to install run this manually at this point since its not an app, but If enough people are interested in this I can create an app that can be installed and used via the ReadyNAS OS6 web interface. Or maybe it won't be needed on the 6.2 update coming out soon, but I still have use for it on other systems.
This is the first version and I have tested it on my shares and everything seems to be working fine, but I would reccommend you take a snapshot of any share first just to be on the safe side.
The script does back up the current ACL state of every directory and file in the share in case you want to revert back.
One other thing to note is that you need to use the web interface to modify and permission changes to the share root since it will not pick up changes if you mannual copy permissions from one share to another.
Here is the location of the script (https://github.com/nrgaway/reset-acls) and this is a copy of the README:
So I wrote a bash script yesterday to do the job since I could not find anything out there that could reliabily and recursively apply ACL changes while keeping executable permissions for files in tack. You will need to install run this manually at this point since its not an app, but If enough people are interested in this I can create an app that can be installed and used via the ReadyNAS OS6 web interface. Or maybe it won't be needed on the 6.2 update coming out soon, but I still have use for it on other systems.
This is the first version and I have tested it on my shares and everything seems to be working fine, but I would reccommend you take a snapshot of any share first just to be on the safe side.
The script does back up the current ACL state of every directory and file in the share in case you want to revert back.
One other thing to note is that you need to use the web interface to modify and permission changes to the share root since it will not pick up changes if you mannual copy permissions from one share to another.
Here is the location of the script (https://github.com/nrgaway/reset-acls) and this is a copy of the README:
reset-acls
------------
Bash script to restore all acl permissions within a directory tree with those provided by a source acl directory
Usage: reset-acls <source acl directory> [<target acl directory>]
Examples: To copy the acl from /data/media to all its children
reset-acls /data/media
reset-acls /data/media /data/media
To copy the acl from /data/media to /data/music and all its children
reset-acls /data/media /data/music
NOTES
- If only the source directory is provided then that directory will be restored to the acl of the parent of the source.
- You must have appropriate permissions to be able to run this script or it will not work (read/write/execute) on every directory and file within target -The acl reset should not cross file systems by design, but I have not tested what happens with links yet
- All current acls are backed up before any changes are made so they can be restored although all files and directories owner and group names are changed to the source directory so it would be more difficult to restore
- This script should honor the current settings of executable and non executable files
- It may be possible to set up a cron job to automatically task
PROCESS
- Target directory current acls are backed up so they can be restored
- All current acl properties are removed
- Target Files and directories are renamed to same as source
- Target is restored to same acl (access and default) as source
TODO
- May add option not to rename files and directory user and group names automatically
- May require a prompt for users trying to restore a directory structure where the source does not have a default acl
- Don't allow source parent directory to have it acl changed on reset since it is the source and we do not want it messed up if something goes wrong
- Implement a way to prevent specific directory trees or files within the target from being updated. I am thinking if a sub directory has the +T attribute then it and its children will not be reset. Same goes for individual files
Replies have been turned off for this discussion
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!