Ubuntu – How to chmod files that have a specific set of permissions

chmod

I want to find all files in a folder that have -rw-r----- (640? is that the right code?) permissions, and change them all to have -rw-rw-rw- instead. How do I do this, with chmod?

I know I could do the whole folder with

sudo chmod -R 666 /path/to/folder

but I think (perhaps mistakenly?) that it would be more efficient to just do the ones that actually need it?

Alternatively, rather than specifically looking for -rw-r-----, I could chmod any file that doesn't have 666 already? Would that be better?

Best Answer

find /path/to/folder -perm 640 -exec chmod 666 {} \;
Related Question