Tutorial: Installing OpenSSH SFTP server on Debian Latest

This tutorial will guide you through the process of installing OpenSSH SFTP server on Debian Latest.

Prerequisites

Before you begin, make sure you have the following:

Step 1: Update the System

First, update the system to ensure that all packages are up to date.

sudo apt-get update
sudo apt-get upgrade

Step 2: Install OpenSSH server

OpenSSH server is required for SFTP server to work. To install it, run the following command:

sudo apt-get install openssh-server

Step 3: Configure OpenSSH SFTP 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.

Step 4: Create an SFTP user

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

Step 5: Restart OpenSSH server

To apply the changes we made to the OpenSSH server, we need to restart it.

sudo systemctl restart sshd

Step 6: Test the SFTP server

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!