Select Page

Linux remote backup via rsync

The following is a simple example of using rsync to backup remote data in a cron scheduled fashion.

*/5 * * * * rsync -vrupogtzh -e "ssh -p 22" --exclude ".git" root@IP:/path/from/ /path/to/ > /dev/null

 

Reset directories and files permissions

I’ve always wondered what it should be the default file and folders permissions for a web app. Well, there are multiple factors including config server config, app configuration files, cache and tmp folders, etc.

In any case, this is my prefered default permissions to start working with, kind of “reset/restore”:

find /FOLDER/* -type d -exec chmod 755 {} \;
find /FOLDER/* -type f -exec chmod 644 {} \;

If you’re on shared hosting and this does not work just change hosting… pardon, try using 775 for directories and 664 for files.

If neither these are working then you do have a problem and most likely is not permissions. Apache/NGINX/PHP or your app logs are a good place to start.

Some try to fix their problems by using 777. Be my guest but please don’t blame me.