Disable Root Login for Better VPS Security

Disable Root Login for Better VPS Security

Allowing direct root login via SSH is risky and makes your VPS vulnerable to brute-force attacks. It’s recommended to disable root login and use a regular user with sudo privileges.

Step 1: Create a New User

sudo adduser newuser
sudo usermod -aG sudo newuser

Step 2: Login with New User

ssh newuser@your-server-ip

Step 3: Disable Root Login

Edit the SSH configuration file:

sudo nano /etc/ssh/sshd_config

Find the line:

PermitRootLogin yes

Change it to:

PermitRootLogin no

Step 4: Restart SSH Service

sudo systemctl restart ssh

✅ Now root login is disabled, and only your new user can log in with SSH, making your VPS more secure.

  • VPS Security, Server Protection, SSH Hardening, Root Login
  • 0 Utenti hanno trovato utile questa risposta
Hai trovato utile questa risposta?

Articoli Correlati

How to Set Up a Firewall (UFW) on Your VPS

How to Secure Your VPS with a Firewall A firewall is essential for protecting your VPS from...

Securing SSH Access on Your VPS

Securing SSH Access on Your VPS SSH is the primary way to access your VPS. By hardening SSH,...

Protecting Your VPS with Fail2Ban

Protecting Your VPS with Fail2Ban Fail2Ban helps protect your VPS from brute-force attacks by...

Securing Your VPS with UFW Firewall

Securing Your VPS with UFW Firewall UFW (Uncomplicated Firewall) helps you manage firewall...

Change Default SSH Port to Prevent Attacks

Change Default SSH Port to Prevent Attacks By default, SSH runs on port 22, which is the...