Linux is one of the most secure operating systems out there, but that doesn't mean it's free from attacks or vulnerabilities. Experts recommend always taking extreme precautions. Therefore, we leave you some tips to properly shield Linux servers in our post today.
In LinuxAndUbuntu we found an interesting article including the following security advices:
Set up a non root user. The root user is not considered completely secure to log into the server. It is advisable to create privileged users in the sudo group, since they will always require authentication to make changes in the server.
Improve the login system. It is essential to set strong passwords for users, including numbers, letters, and symbols. With this simple gesture, you will be better protected from brute force attacks. To avoid entering the password each time you log into the server, you can create an SSH key.
Keep the server updated. Security updates are pretty frequent in Linux distributions, and it is advisable to install all of them as soon as possible. Setting the server to check for and install unattended updates automatically is an excellent option.
Uninstall unnecessary applications or services. On servers, it is better to remove unnecessary packages, as they can constitute a security threat. If you have several services that perform the same tasks, it is better to keep only one of them.
Close unused server ports. Cyberattackers look for open ports to gain access to servers, so it is best to keep only the ports that are necessary open. You can configure the firewall to block all ports and then open the necessary ones.
Block malicious requests and IP addresses with Fail2ban. This solution analyzes the system logs and blocks malicious attacks and the IP addresses that execute those attacks. Also, it stops brute force attacks that try to discover passwords to access systems.
Configure 2FA. Two-factor authentication provides an extra layer of security when accessing the server. Once the user has entered his credentials, the system demands a second one-time password that is sent to the user.
Change the default ports of SSH services. SSH & FTP services are more likely to be attacked. Therefore, it is highly recommended changing the ports that come by default.
Use Spamassassin to scan and delete spam emails. This tool scans all incoming emails that reach an email server, detects and blocks malicious and unwanted ones.
Perform security audits regularly. Regular checks are the best way to make sure your server is adequately protected. It is crucial to verify that security tools start at system startup and manually monitor storage, memory usage, and system logs.
For some extra tips, check out the full article at LinuxAndUbuntu