How to Harden an Ubuntu Linux Installation


Harden MYSQL

mysql_secure_installation

answer Yes to all questions

Harden PHP

apt-get install php5-suhosin

https://help.ubuntu.com/community/StricterDefaults

In Ubuntu the administrative ROOT account is disabled by default.

https://help.ubuntu.com/community/StricterDefaults

Reconfiguring Shared memory to Read Only

sudo vi /etc/fstab

add line

tmpfs /dev/shm tmpfs defaults,ro 0 0

Disabling SSH root login and aettings

sudo vi /etc/ssh/sshd_config

change

PermitRootLogin yes
to
PermitRootLogin no

LoginGraceTime 120
to
LoginGraceTime 20

add line

AllowUsers username username username

sudo service ssh restart

if that does not work, try:

sudo /etc/init.d/ssh restart

Limiting access to the “su” program

sudo chown root:admin /bin/su
sudo chmod 04750 /bin/su

Install Fail2ban

Install Fail2ban
Fail2ban Wiki

Install Bastille Linux

Install Bastille Linux
https://help.ubuntu.com/community/BastilleLinux

Harden WordPress

The php.ini file adjusts how PHP behaves. This file is generally located in your public directory. If you’re unable to see this file, you may need to manually generate one. Check these two variables are set to Off:

register_globals Off
display_error Off


Get a Linode SliceI can highly recommend Linode installations. Easy, fully functional, optimized, ready to go, LAMP stack.