I want all files in every user's home directory to be 0740 or less permissive.
Let's say a user has perms like this:
-rwxr----- 1 doej users 321 Jan 6 2013 file1.txt
-rwxrwx--- 1 doej users 555 Jan 6 2013 file2.txt
-rwxr-xr-x 1 doej users 875 Jan 6 2013 file3.txt
-r--r--r-- 1 doej users 875 Jan 6 2013 file4.txt
-rwxr----x 1 doej users 875 Jan 6 2013 file5.txt
-r--r----x 1 doej users 875 Jan 6 2013 file6.txt
-r-------- 1 doej users 875 Jan 6 2013 file7.txt
-rwxrwxrwx 1 doej users 875 Jan 6 2013 file8.txt
I'm looking for the ability to:
- change files like file8.txt to chmod 740
- leave alone files like file7.txt
- change files like file6.txt to chmod 440
Essentially, reduce excessive permissions without adding more permissions.
If I do this, it will add excessive permissions to files which are below the requirements:
sudo chmod 0740 /home/*
Is there a command to do this? Does it require a bash script?