Question about the command find in ubuntu 18.04 server version

hello everyone.
may I ask if any one know what is this for @miguel :

  • sudo find /var/www/wordpress/ -type d -exec chmod 750 {} ;
  • sudo find /var/www/wordpress/ -type f -exec chmod 640 {} ;
man find


Basically, it chmods all directories (folders) to 750 and all regular files to 640.

1 Like
It’s already done but I was just wondering what is it for

Which part? The chmod part? It makes your files only read-write to owner, readable to owner’s group, and not readable to anyone else. That’s the 640 part, for example.

It’s a bunch of binary flags, put together.

The importable part:

1 Like

The reason they use find instead of just chmod -R is because they want directories to have slightly different permissions than the files. If you just did chmod -R 640 /var/www/wordpress/ you set all files and directories to 640. But they want the directories to be 750.

“execute” permission in a directory means being able to enter that directory.

1 Like

BTW, this is really nothing to do with Ubuntu or the server version.

Unix file permissions go back to the 1970s, long before Linux even existed.

Not only did this exist before Linux, it existed before you were born.

Heck, it existed even before I was born! :slight_smile:

1 Like