Secure your Ubuntu Server

First thing to do when setting up a Ubuntu Server is to make sure it’s secure.¬†Install fail2ban to make sure you block IP-addresses that try to break in, and log everything with logwatch.

Update the system.


Install fail2ban.


Copy the configuration file.


Edit the file.


Change the ban time from 600 (10 minutes) to 604800 (7 days) and CTRL + O to save and CTRL + X to exit.


Install logwatch.


Edit logwatch daily cron to email you the log.


Add this line at the bottom and replace the example email with your own. Save with CTRL + O and exit with CTRL + X.