In the case where the user home directory contains one or more NFS mount points, how can I skip these mounts and efficiently change directory permissions?
I want to run chmod o-rwx on all non-mounted directories under a user's home directory.
I will be running the command as the root user because I'm doing this for all users on the system. (The NFS mounts have the root_squash mount option.)
Here is what I tried. However, it is not working as expected.
sudo find /home/myuser/ -mount -path ./Documents -prune -o -type d -exec chmod o-rwx {} \; chmod: changing permissions of '/home/myuser/Documents': Operation not permitted I want to avoid the error message. More importantly, the find command is taking a very long time to run. I believe that indicates it is descending into the mount points (which contain many directories and files).
Another problem with my command is that I have to explicitly code for the locations to skip. All users have Documents mounted, but some users have other NFS mounts of different names.
My goal is to automate the fixing of simple directory permission problems in a user account (i.e., chmod o-rwx). How can I do this in my situation?
-mountoption. Is that what you were suggesting? All you did was post a link, so I don't know what you intended me to see there.-mountprevents descending into mounted directories, so it will only exclude contents ofDocuments, notDocumentsitself../Documentsliterally against the full path including the base you provided (/home/myuser/Documents). To do it on a larger scale you probably need to change the -path argument to*/Documentsor/home/*/Documents.