ihave an umask 0002 using umask -S it returns u=rwx,g=rwx,o=rx.
How do i find all files and directories that does now have rights set up accordin 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 differnt 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 is the newly created file bcs it is looking for files that does not have 775 rights (Directory rights)
Here is my version:
m=`umask`
fperm=`printf '0%o' $(( 0666 & ~$m ))`
dperm=`printf '0%o' $(( 0777 & ~$m ))`
find -type f -perm $fperm -o -type d -perm $dperm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With