I have an umask as a 0002
using umask -S
it returns u=rwx,g=rwx,o=rx
.
How do I find all files and directories that does not have rights set up according to mask?
The directories goes 777 - mask
and files 666 - mask
If i do something like
find . ! -perm $(umask -S)
it will find all files/directories that does not have rights set to u=rwx,g=rwx,o=rx
( 777 - 002 are there rights but 666 - 002 are different rights) which is good for directories, but not for files.
How do I find files, that have different rights than current set umask ?
example
touch one
ls -l
-rw-rw-r-- 1 trolkura trolkura 0 kvě 4 09:01 one
umask is 0002 so this results in 664
, but when I do
find . -type f ! -perm $(umask -S)
./one
result shows newly created file because it is looking for files that does not have 775
rights (Directory rights).