https://www.cyberciti.biz/faq/howto-set-readonly-file-permission-in-linux-unix/ Change file attributes on a Linux file system to read-only using the `chattr` command: ```sh chattr +i /path/to/file.php chattr +i /var/www/html/ # find everything in /var/www/html and set to read-only # find /var/www/html -iname "*" -print0 | xargs -I {} -0 chattr +i {} ``` ```sh To remove read-only attribute pass the -i option: # chattr -i /path/to/file.php ``` FreeBSD, Mac OS X and other BSD unix user need to use the `chflags` command: ```sh # set read-only chflags schg /path/to/file.php # remove read-only chflags noschg /path/to/file.php ```