Search The Hostwinds Guides Knowledge Base

Best Security Practices For A Linux Server

How Can I Secure My Linux Server?

A number of measures can be taken to secure your server in the best way possible to mitigate malicious issues.  Below you’ll find some of the best practices to apply when securing your Linux servers.

 

Changing The SSH Port

Create A Second User That Is Not Root

Restrict Access To The Root User(s), Either Through

  • IP Address
  • Or disable access entirely

Disable Password Authentication For SSH And Enable Key Based Authentication

 

Creating A User From The Command Line Or Shell

Step 1:  Open a shell prompt.

Step 2:  If you are not logged in as root, type the command su – and enter the root password.

Step 3:  Type useradd  followed by a space and the username for the new account you are creating at the command line (for example, useradd jdoe ). Press [Enter]. Often, usernames are variations on the user’s name, such as jdoe for John Doe. User account names can be anything from the user’s name, initials, or birthplace to something more creative.

Step 4:  Type passwd  followed by a space and the username again (for example, passwd jdoe ).

Step 5:  At the New password: prompt enter a password for the new user and press [Enter].

Step 6:  At the Retype new password: prompt, enter the same password to confirm your selection.

 

If you need further assistance on securing your Linux server please reach out to us by Opening A Support Ticket.  We will be happy to help you add increased measures above and beyond the ones listed here.

 

Helpful Related Articles