How To Set CHMOD on Linux Distribution System via CLI


If you’re currently running the LAMP/LEMP stack without a control panel on cloud server, you must specify the correct CHMOD for both directories/folders and files. This can be done via command line interface (CLI).

The standard CHMOD is usually 0755 for folder/directory permissions and 0644 for file permissions. For example, in this guide we will set folder pemission to 0755 (-rwxr-xr-x) on directory /home/

Simply run the following command:

$ find /home/ -type d -exec chmod 755 {} \;

With the above command it will also set recursion permissions for all folders inside the /public/ directory. On the same screen, we also need to set recursion file permissions to 0644 (-rw-r–r–) for all files inside the public directory.

$ find /home/ -type f -exec chmod 644 {} \;

Make sure to replace /home/ with your actual directory or document root on your virtual machine. Don’t forget to also set correct ownerships for all file/folders inside your document root (path to your public directory).

For example, we need to change user and group ownerships to cekips. So, simply run the following command. It will set user and group ownerships to cekips on all file and folders inside /home/ directory.

$ chown -R cekips:cekips /home/