This tutorial will guide you through the process of installing OpenSSH SFTP server on Debian Latest.
Before you begin, make sure you have the following:
First, update the system to ensure that all packages are up to date.
sudo apt-get update
sudo apt-get upgrade
OpenSSH server is required for SFTP server to work. To install it, run the following command:
sudo apt-get install openssh-server
Next, we need to configure OpenSSH server to allow SFTP connections.
Open the sshd_config file using a text editor of your choice.
sudo nano /etc/ssh/sshd_config
Find the following line in the file:
Subsystem sftp /usr/lib/openssh/sftp-server
And replace it with:
Subsystem sftp internal-sftp
Add the following lines at the end of the file:
Match group sftp
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
Save and close the file.
To create an SFTP user, run the following command:
sudo adduser sftpuser
Set a password for the new user when prompted.
Next, add the new user to the SFTP group:
sudo usermod -aG sftp sftpuser
To apply the changes we made to the OpenSSH server, we need to restart it.
sudo systemctl restart sshd
Finally, we can test if the SFTP server is working.
From another system, open an SFTP client and connect to your Debian Latest system using the SFTP user credentials you just created.
If the client is able to connect and authenticate successfully, then the SFTP server is working.
Congratulations, you have successfully installed and configured OpenSSH SFTP server on Debian Latest!
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!