Setting up security rules for server users
Server security is one of the most important aspects that needs to be configured correctly to protect information. In this article, we’ll look at the basic security rules for server users.
1. Creating a separate user
The first step in ensuring server security is to create a separate user with limited privileges. Never use the root user for normal tasks, as this increases the server’s vulnerability level.
sudo adduser newuser
2. Setting a password and using SSH keys
Set a strong password for the new user and enable SSH key authentication to enhance server security.
sudo passwd newuser
After setting the password, generate SSH keys on your computer and add them to the ~/.ssh/authorized_keys file on the server.
3. Restricting SSH access
Configure the /etc/ssh/sshd_config file to disable password authentication and allow only SSH keys. You can also change the default SSH port to make it harder for attackers to gain access.
sudo nano /etc/ssh/sshd_config
After making changes, restart the SSH service:
sudo systemctl restart sshd
4. Installing a firewall
Install and configure a firewall on the server to control traffic and prevent unauthorized access to the system.
sudo apt install ufw
sudo ufw enable
sudo ufw default deny incoming
sudo ufw default allow outgoing
5. Updating the system and software
Regularly update the operating system and installed software to fix vulnerabilities and ensure server security.
sudo apt update
sudo apt upgrade
Conclusion
Following these security rules will help reduce server vulnerabilities and protect your data from unauthorized access. Remember that security is an ongoing process and security measures should be updated regularly.