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:
- Find the line that says
#PermitRootLogin ...
and change it to: - Save the file and exit the editor (Ctrl + O, Enter, Ctrl + X).
- Restart the SSH service:
sudo nano /etc/ssh/sshd_config
PermitRootLogin yes
sudo systemctl restart ssh
Debian 11 & 12
- Open the terminal and edit the SSH configuration file:
- Locate the line
#PermitRootLogin prohibit-password
and change it to: - Save and exit the editor.
- Restart the SSH service:
sudo nano /etc/ssh/sshd_config
PermitRootLogin yes
sudo systemctl restart ssh
CentOS 7
- Open the terminal and edit the SSH configuration file:
- Find the line
#PermitRootLogin yes
and ensure it is uncommented: - Save the changes and exit the editor.
- Restart the SSH service:
sudo nano /etc/ssh/sshd_config
PermitRootLogin yes
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