Verify File Integrity with Hashdeep

File integrity ensures that the files on your system have not been modified since the last time you generated a checksum of the file. Checksums are often times generated and displayed when downloading files off of the internet to ensure that the file you downloaded is both properly downloaded and that the file downloaded is identical to the one being offered. File integrity can also be used on your server to alert you whenever a file has been modified.

How to Setup cron-apt

Keeping your server up-to-date with the latest patches is important, but if your VPS is only used for your hobby projects, it can become difficult to remember to always check for updates and keep the server up-to-date. Lucky for you, a program called “cron-apt” exists. Cron-apt by default runs daily and will check for what packages need to be updated by using APT (Advanced Package Tool). Further configuration of cron-apt allows for the results to be e-mailed directly to you.

Server Memory

How to Check Amount of Available Server Memory

In the sections below you will learn how to identify the amount of memory that is installed on your server, check how much of the RAM is being used, and see a list of the applications using the most memory. Other than physical memory that is installed on your server, servers may also have burst memory, VSwap, and Swap memory.

Before the main tutorial, some basic knowledge about the types of memory may come in handy. First we have physical memory which is the memory that is physically installed onto the motherboard. Swap memory is used when the physical memory has approached its limit; your operating system will start storing memory onto your hard drive, also known as Swap memory. VSwap is similar to Swap memory, but VSwap is used for VPS servers that use OpenVZ. VSwap allocates unused physical memory from the server and provides it as Swap Memory, but it does artificially slow down the reading and writing to the memory. Finally burst memory is something that mostly belongs in the past. Providers would provide additional memory to your VPS when you were starting to run low on memory if any additional memory on the server was available.

Send Email Notification after a SSH Login

Setting up e-mail notifications and alerts when a user signs in through SSH requires a shell script and a small modification to PAM. Keep in mind that if you’re setting up this alert for security, then you probably want to look at locking down your system first and securing all of your services instead of just receiving alerts. This notification can be useful as an extra alert for logins, but don’t rely on it as a security feature because you won’t always be monitoring your e-mail, and once an attacker signs into your server, it’s too late.

How to Run Scripts after SSH Authentication

After SSH authentication you may want to run a set of scripts for the current user or for the server. These scripts could include logging SSH user logins, mounting partitions or remote file systems, limiting how many users can be on the system at a time, or any other script that should trigger when a user signs onto the system. This tutorial will outline how to update PAM (Pluggable Authentication Module) to run a shell script after the user is successfully authenticated.