SFTP or SSH as root on Raspberry Pi

Login to your pi as normal via SSH and edit your SSH Configuration with the following

sudo nano /etc/ssh/sshd_config

Find the line that reads as follows (line 32)

#PermitRootLogin prohibit-password

Un-comment this line and change the option to “yes” by making the line now read as follows :

PermitRootLogin yes

Now reboot your pi and log back in via ssh, and now set a password for root using the following command

sudo passwd root

You will now be able to SFTP or SSH into your pi as root, especially useful to to upload files into protected file system areas, or edit files directly on the file system from a remote machine.

Note that the above commands can be run in the console or terminal directly on the pi also, however I’ve referred to doing this via ssh as it seems the most often used approach.

Posted in Raspberry Pi and tagged , , , .

Leave a Reply

Your email address will not be published. Required fields are marked *