OpenSSH SFTP server is a powerful tool that allows you to secure file transfers over an encrypted SSH connection. In this tutorial, we will guide you through the process of installing OpenSSH SFTP server on Ubuntu Server Latest.
Before proceeding with the installation process, you must have the following prerequisites:
The first step is to update and upgrade the system to ensure that all the packages are up to date.
$ sudo apt-get update && sudo apt-get upgrade
Next, we need to install the OpenSSH server on Ubuntu. Run the following command:
$ sudo apt-get install openssh-server
Once the installation is complete, we need to configure the OpenSSH server to enable SFTP service. Here's how:
/etc/ssh/sshd_config
using any text editor.$ sudo nano /etc/ssh/sshd_config
#Subsystem sftp /usr/lib/openssh/sftp-server
Change it to:
Subsystem sftp internal-sftp
Match group sftp
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
In this step, we will create an SFTP-only user that will be used to upload/download files. Run the following commands:
$ sudo groupadd sftp
$ sudo useradd -g sftp -d /incoming -s /usr/sbin/nologin sftp_user
$ sudo passwd sftp_user
$ sudo mkdir /home/sftp_user/incoming
$ sudo chown sftp_user:sftp /home/sftp_user/incoming
These commands will create a new sftp
group, an SFTP-only user called sftp_user
, and a directory called incoming
within the home directory of sftp_user
.
After making the necessary changes, restart the SSH service to apply the new settings.
$ sudo systemctl restart ssh
Now that the SFTP server is configured, it's time to test if it's working. Here's how:
sftp_user
in our case).incoming
directory.If everything is working perfectly, the files should upload/download successfully.
Congratulations! You have successfully installed and configured the OpenSSH SFTP server on Ubuntu Server Latest. It is a powerful tool that can help you securely transfer files over an encrypted SSH connection.
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!