SFTP is a built-in feature of SSH, and once SSH is installed on a system, SFTP can be used to transfer files back and forth with a GUI or terminal. SFTP is especially useful with servers.
In this guide, we’ll show you how to connect to SFTP servers on Ubuntu, as well as how to configure your own server to host. To get started, ensure you use the latest Ubuntu desktop, Server, or an OS based on Ubuntu.
Set up SFTP on Ubuntu
If you plan to connect to an SFTP server on your Ubuntu PC, you’ll have to set up an SSH server on your remote Ubuntu server or remote Ubuntu PC so you can access it. Thankfully, setting up an SSH server on Ubuntu is incredibly easy.
To start, open up a terminal window on the Ubuntu desktop. You can launch a terminal window by pressing Ctrl + Alt + T on the keyboard. Or, search for “Terminal” in the Ubuntu app menu and launch it that way.
With the terminal window open, use the apt install command to install the “openssh-server” package. This package, once installed, will configure and set up an SSH server, as well as SFTP, which you can access remotely.
sudo apt install openssh-server
When the OpenSSH server is up and running on the remote computer, you can do a quick test to ensure that you can connect to it. To do that, run ssh your-username@localhost on the machine with the SSH server. You must use your username password to log in.
Connecting to SFTP over the command-line
To connect to an SFTP server with the command-line on Ubuntu, start by launching a terminal window. Then, with the terminal window open, use the sftp command to connect to your SSH server.
To connect, specify the username on the remote machine, as well as its IP address. For example, if the remote Ubuntu server or Ubuntu PC hosting an SSH server has an IP address of “192.168.1.203,” use that as the hostname.
Once connected, you can run the ls command to view what is on the remote server.
To download anything from the remote server to your home directory, specify the file name on the remote SFTP server and use the get command.
Need to upload something to the remote SFTP server? Use the put command. It will upload any file to the remote SFTP server in your local home folder (/home/USERNAME/).
Connecting to SFTP with the Ubuntu file manager – Gnome Files
The Gnome Files app is one of the most used file managers on all of Linux, as many mainstream Linux distributions choose Gnome Shell as their desktop. Here’s how to use it to connect to an SFTP server with it on Ubuntu.
To start, launch the Ubuntu file manager on the desktop. When it is open, find the “Other Locations” button, and click on it. When you select this button, you’ll be taken to the “Other locations” area.
Inside “Other locations,” find the “Connect to Server” text box and click on it with the mouse. Then, type out the address of the server. For example:
After entering the IP address (or hostname) in the box, press the “Connect” button. When you select this button, a pop-up window will appear. Next, enter your username and password, then click “Connect” again.
Upon connecting, you’ll see your SFTP server in the Ubuntu files app. Drag files into the server to upload them and copy them to other folders on your PC to download them.
Connecting to SFTP with Filezilla on Ubuntu
You must first install the app to connect to an SFTP server using Filezilla on Ubuntu. Then, open up a terminal window on the Ubuntu desktop, and use the command below to install the app.
sudo apt install filezilla
Once the program is installed on your system, launch it. Then, find the host box and type in the code below.
After writing in the “Host” box, write your username into the “Username” box, your password into the “Password” box. Then write “22” into the “Port” box. 22 is the default port for SFTP.
Select the “Quickconnect” button to connect to your SFTP server with Filezilla when all information is filled out. You’ll soon be connected to your server with Filezilla.
From here, you can upload and download files to your SFTP server from Ubuntu. If you’d like to download a file, here’s what to do. First, right-click on the right column with the mouse on a file you want. Then, select the “Download” option to download.
You can also upload from Ubuntu using Filezilla. To do it, right-click on a file in the left column with the mouse. Then, select the “Upload” button. Doing this will send the file to the SFTP server.