Received unexpected end-of-file from SFTP server – Solved

If you receive the following error when trying to use SFTP:

Received unexpected end-of-file from SFTP server

This can be solved as follows:

sudo nano /etc/ssh/sshd_config

Comment out the following line:

Subsystem sftp /usr/lib/openssh/sftp-server

Insert the following below the line you commented out:

Subsystem sftp internal-sftp

Save the file with CTRL + o and restart SSH with:

sudo service ssh restart