Question

Securing a new LAMP/LEMP server

Posted October 28, 2013 6.3k views
I’ve finished configuration on a new LEMP server and wonder: what measures do folks suggest for securing my new VPS? Root login is disabled, I’m using strong passwords and fail2ban is enabled. What else might I want configure/enable?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
3 answers
From serverfault | Why change default ssh port?

Whatever port you chose, if you do move away from 22, make sure it is below 1024. Under most Unix-a-like setups in their default config, only root (or users in the root group) can listen on ports below 1024, but any user can listen on the higher ports. Running SSH on a higher port increases the chance of a rogue (or hacked) user managing to crash your SSH daemon and replace it with their own or a proxy.
1.) Disable password logins and use key-based authentication, instead;
2.) Change your SSH port from the default Port 22 to a random port below 1024; and
3.) Enable a firewall.

Check out the Security Hardening section of Automated Provisioning of DigitalOcean Cloud Servers with Salt Cloud on Ubuntu 12.04
Apologies for hijacking this thread

@Pablo, I bow to your greater knowledge, why use a port below 1024?
Submit an Answer