How to Enable Root Logins via SSH

Follow these steps to enable root logins on various Linux distributions via SSH:

To start, login to your VPS via the default credentials, they can be found via our dashboard.

Ubuntu 20.04 & 24.04

  • Open the terminal and edit the SSH configuration file:
  • sudo nano /etc/ssh/sshd_config
  • Find the line that says #PermitRootLogin ... and change it to:
  • PermitRootLogin yes
  • Save the file and exit the editor (Ctrl + O, Enter, Ctrl + X).
  • Restart the SSH service:
  • sudo systemctl restart ssh

Debian 11 & 12

  • Open the terminal and edit the SSH configuration file:
  • sudo nano /etc/ssh/sshd_config
  • Locate the line #PermitRootLogin prohibit-password and change it to:
  • PermitRootLogin yes
  • Save and exit the editor.
  • Restart the SSH service:
  • sudo systemctl restart ssh

CentOS 7

  • Open the terminal and edit the SSH configuration file:
  • sudo nano /etc/ssh/sshd_config
  • Find the line #PermitRootLogin yes and ensure it is uncommented:
  • PermitRootLogin yes
  • Save the changes and exit the editor.
  • Restart the SSH service:
  • sudo systemctl restart sshd

Important Notes

  • Enabling root login can pose security risks. Consider using sudo for administrative tasks instead.
  • Ensure that you have a strong password for the root account.
  • Always monitor your server for unauthorized access attempts.

Document Publish Date: 5th of December, 2024

Close

Discount     Save 35% using discount code FREEPALESTINE 🇵🇸 Order a VPS