Is there a way to go into my home directory and recursively set files and directories to match my umask setting? The issue is, way back when I started using linux, I didn't understand permissions. In order to make stuff work, I set a lot of things to 777 just to keep moving and get stuff done.
Now that I understand a bit more, I've modified my umask setting to give me the permissions I actually need along with setting my primary group the way I need it to be. All is good moving forward, but I still need to deal with a large number of files and directories.
Anyway, I would like to be able to set the files to rw-rw-r-- and the directories to rwxrwxr-x and do that recursively from the home directory.
Any help would be appreciated.
2 Answers
This example of using the find command with chmod might be useful:
1Alan's answer above gave me the information I needed to figure this out, but I had to drill down through the comments to find my best solution. The solution I ended up using looked like this:
sudo chmod -R u=rw,g=rw,o=r,a+X /path/to/target
The idea in my case was to have users and groups read and write and others read only. Specifically setting users and groups to rw and others to r effectively removed the 777 permissions I had on pretty much all my files. Then, setting all to X (uppercase X) went back and added execute permission to directories.
1