Ubuntu – Setting files and directories to match umask setting recursively

chmodcommand linepermissionsumask

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.

Best Answer

This example of using the find command with chmod might be useful:

https://superuser.com/questions/91935/how-to-chmod-755-all-directories-but-no-file-recursively