I have an awesome OpenVPN server setup on a Raspberry Pi to help protect my privacy when I travel. I have used it a couple times, and it has worked without a hitch; until last weekend. Prior to taking a weekend trip, I fired up the Pi, started the OpenVPN server, but I didn’t test to make sure I could connect. That would have been helpful, since I left out a critical step: opening up the proper port on my router. That’s right, my OpenVPN server ran all weekend waiting for connections that could not be made, while I used my cellular data rather than the free, insecure WiFi I had available to me. This got me wondering whether I could edit the message that is displayed when logging into the Pi via ssh. The answer: yes I can, and yes you can.
In Part 1 of this tutorial, we covered how to configure rsync so we can backup our important files. Now we will use Cron to automate our backup, so we don’t have to worry about remembering!
When deciding what you want to backup, you may want find that you only want to backup certain parts of a directory. For example, you may want to backup your pictures, documents, etc. in your home folder but not temp files, config files, etc. No problem. In rsync, this is accomplished by using include and exclude rules.
If you don’t want to save everything in your /directory/to/copy/, you will most definitely want to use an exclude file, and you may use an include file as well. The reason you may not use an include file is that include may not do exactly what you think it will. For instance, if you only want to save your pictures and documents in your home folder, you can’t just tell rsync to include pictures and documents. This is because everything in /directory/to/copy/ is automatically included the backup. Therefore, if you tell rsync to backup your home folder and then also tell it to include pictures and documents, it will still backup your entire home folder. Include rules are not worthless, however, as they can override exclude rules. If this doesn’t make sense now, don’t worry the following examples will explain the weirdness more concretely.