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
- Creating A User From The Command Line Or Shell (Please See Steps Below)
- How To Create A New User (CentOS 7)
- How To Create A New User (Ubuntu)
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.
Helpful Related Articles
- How To Stay Informed About Breaking Security Updates Or Patches
- Firewalls Management
- What Are Permissions On Linux?
- Common Linux Commands