Raspberry Pi

How to Enable SSH Root Login on Raspberry Pi

SSH root login on Raspberry Pi is important since it allows users to take full authority on the system from remote access and the user can perform any activity on the system. They modify the system, manipulate files, perform troubleshooting and more. However, by default, the SSH root login is disabled on Raspberry Pi for security purposes. If you want to enable SSH root login on the Raspberry Pi system, you can follow this tutorial to learn about enabling it.

How to Enable SSH Root Login on Raspberry Pi

To enable the SSH root login, use the following steps:

Step 1: First, you should open the SSHD configuration file on the Raspberry Pi terminal via the following command:

$ sudo nano /etc/ssh/sshd_config

Step 2: Inside the file, find the line “#PermitRootLogin”, which is disabled by default using “#”.

Step 3: Enable it by removing the “#” sign and add “yes” instead of “prohibit-password”.

Step 4: Save the configuration file using “CTRL+X”, add “Y” and press Enter.

Step 5: Restart the SSH service on Raspberry Pi for the changes to occur and it can be done through the following command:

$ sudo systemctl restart sshd

Step 6: Now, to confirm the Root login is enabled, you can run the following command on the Raspberry Pi terminal:

$ ssh root@Pi-IPAddress

Note: Enter the “hostname -I” command to get the Raspberry Pi IP address.

Step 7: Enter the default root password to log in to Raspberry Pi as root.

Use SSH Root Login on PuTTY

You can access the Raspberry Pi terminal as a root on PuTTY through the following steps:

Step 1: Enter the IP address/hostname of Raspberry Pi and choose the “Open” button.

Step 2: Login as root and enter the default password to access the Raspberry Pi terminal as a root user.

Note: You can disable the SSH root login again by adding the “#” before the “PermitRootLogin” option inside the SSH configuration file.

Conclusion

The Raspberry Pi users can easily enable the SSH root login by opening the SSHD configuration file through the nano editor and removing the “#” sign from the “PermitRootLogin” option. Then, add “yes” in front of the “PermitRootLogin” option and restart the SSH service to apply the changes. After that, they can access the Raspberry Pi terminal by login in as “root” with the default password.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.