wesupport

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Secure an Ubuntu Server – What are the best practices?

by | Mar 5, 2021

Wondering how to secure an Ubuntu Server? We can help you.

Not to mention, security is paramount to a business, a few security implementations can go a long way.

As part of our Server Management Services, we assist our customers with several Ubuntu queries.

Today, let us discuss few best practices our Support Techs suggest to secure an Ubuntu Server.

 

Best practices to Secure an Ubuntu Server

Moving ahead, we will discuss User Management, Console Security, Firewall, AppArmor, Certificates, eCryptfs, Encrypted LVM.

 

  • Balance the access rights of users

While users have the tools to get a job done, we also need to protect other users’ privacy and confidentiality.

Ubuntu has three types or levels of user access:

a) Root

The main administrator of the server, the root account has full access to everything on the server. The root user can lock down or, limit folder access, install and remove services or applications, repartition drives, etc. and essentially modify any area of the server’s infrastructure.

b) A sudoer (user)

This user has sudo access. The “sudoer” user has advanced rights to run a function or program as another user. The rules this user has access to are defined within the “visudo” file.

c) A user

This is a regular user, set up using the adduser command, given access to and, who owns the files and folders within the user /home/user/ directory as defined by the basic settings in the /etc/skel/.profile file.

 

  • Enforce Strong Passwords

All of us can agree on the importance of passwords. Hence, enforcing a strong password is a must. In order to do this, we can modify the file responsible for this setting using the ‘change’ command:

/etc/pam.d/common-password
$ chage -m 90 username

This command states that the user must change the password every 90 days.

/lib/security/$ISA/pam_cracklib.so retry=3 minlen=8 lcredit=-1 ucredit=-2 dcredit=-2 ocredit=-1

 

  • Restrict the use of old passwords

Another important step is to restrict the use of old passwords. For this, open ‘/etc/pam.d/common-password‘ file under Ubuntu/Debian/Linux Mint.

$ vi /etc/pam.d/common-password

Then add the following line to the ‘auth‘ section.

auth sufficient pam_unix.so likeauth nullok

In addition, add the following line to the ‘password‘ section to disallow a user from re-using the last five of his or her passwords.

sufficient pam_unix.so nullok use_authtok md5 shadow remember=5

 

  • Checking Accounts for Empty Passwords

Accounts with an empty password mean it is open for unauthorized access to anyone on the web.

Thus it is important that we make sure all accounts have strong passwords.

To check for accounts with an empty password, run:

$ cat /etc/shadow | awk -F: '($2==""){print $1}'

 

  • Install a firewall

Ubuntu provides a default firewall frontend, UFW (Uncomplicated firewall). This is another line of defense to keep unwanted or malicious traffic from actually breaching the internal processes of the server.

The firewall log creates and stores information about attempts and other connections to the server. Monitoring these logs for unusual activities will aid in securing the server.

When using UFW, we can enable logging by running the following command:

$ ufw logging on

To disable logging, we simply run the following command:

$ ufw logging off

[Need help with securing your server? Contact us now]

 

Conclusion

In short, we covered the importance of passwords, user roles, console security, and firewalls all of which are imperative to protecting Linux servers. We saw how our Support Techs perform the same.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags