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)
Un-comment this line and change the option to “yes” by making the line now read as follows :
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.