The scripts I posted to open SSH connections through port knocking are very useful to me. But when it comes to transferring files with SCP, port knocking is a nightmare. So I’ve done a similar bash function that automatically deals with the knocks before starting the scp command.
I’ve introduced a delay of 0.5 seconds between the knocks, because I noticed that sometimes the server was not responding to the knocks. The gist code available at GitHub for the pssh() bash function has also been updated with the delay.
I had implemented port knocking before with linux daemons and knocking clients but this requires installing software that is always running and consuming memory and processor resources. If you are using a Virtual Private Server –as I am–, you can’t afford to waste a single megabyte of memory. Therefore, you begin looking for creative alternatives that minimize the load on the server.
Some time ago, I found a curious implementation of port knocking using iptables. So, if you already have iptables installed on your (virtual) machine, you can get rid of an always-running daemon.
If you ever have to join multiple PDF files into one unique document, you can use Ghostview. Running the following command, it will merge a collection of PDF files into a new one.
When you have to backup a large amount of data, simple backups are a waste of time and storage space. In this situation, the most suitable option is to backup data incrementally. Although there are different methods, today I’ll explain how I use tar to keep my files safe.
With tar, an incremental backup consists of multiple files. The first one is a full dump of the data. This is a simple backup of the files as you would normally do. Simultaneously, the first time you perform an incremental backup it will be created a snapshot file. A snapshot file contains information related to the state of the data in a specific moment. With this information, later you can detect which files have changed and which ones have been added or deleted.