Technical Anshu
Tutorials Blog
Ubuntu SFTP Server

Set Up an SFTP Server on Ubuntu for Secure File Transfer

Your Ubuntu machine can move files for the whole office without a single password or file crossing the network in plain text. This guide installs the server, creates a proper transfer account and proves the connection works.

By Technical AnshuUbuntu Server9 minute read
Watch the complete Ubuntu SFTP server setup step by step in the video

SFTP is file transfer that rides inside SSH, so every password and every file is encrypted end to end. On Ubuntu it is not a separate product you hunt for - it is a small part of the OpenSSH server that is already one command away. Below is the full route: install, start the service, make a dedicated user, open the firewall and test the first connection. Do the steps in order and you will have a working server in about fifteen minutes. The hardening steps that make it safe for real use are linked from the sections where they matter.

Terminal - installing and checking the SSH service
$ sudo apt update
$ sudo apt install openssh-server
$ sudo systemctl status ssh
Active: active (running) since Sun 2026-10-25
Main PID: 1124 (sshd)
The three commands this whole guide stands on. A green active (running) line means the SFTP server is already listening. Server details shown are an example.
1

Install the OpenSSH Server Package

Ubuntu Desktop and Server both ship with an SSH client, but the server side is a separate package. Install it with:

  1. sudo apt update so the package list is fresh
  2. sudo apt install openssh-server and confirm with Y
  3. The installer creates the config at /etc/ssh/sshd_config and generates this machine's host keys automatically

That is genuinely all the software there is. SFTP is a subsystem of this one service, not an extra download, and it answers on the standard SSH port 22.

2

Start the Service and Make It Survive Reboots

The package usually starts the service by itself. Prove it, and make sure it comes back after a power cut:

  1. sudo systemctl status ssh - you want the green active (running) line from the panel above
  2. sudo systemctl enable ssh so it starts at every boot
  3. If it ever stops, sudo systemctl start ssh brings it back, and sudo systemctl restart ssh is the command you will use after every config change in this series

On Ubuntu the service is called ssh, not sshd. Using the wrong name is the most common reason a correct guide appears to fail.

3

Confirm the SFTP Subsystem Line

Open the config once and simply look at it: sudo nano /etc/ssh/sshd_config. Near the bottom you should find this line, which Ubuntu includes by default:

  1. Subsystem sftp /usr/lib/openssh/sftp-server
  2. If the line is missing, add it exactly as shown - without it, SSH logins work but file transfers are refused
  3. Leave everything else alone for now; the later guides in this series change this file one setting at a time, on purpose
4

Create a Dedicated Transfer User

Never hand out your own admin login for file transfers. Make an account that exists only for moving files:

  1. sudo adduser sftpuser and set its password when asked
  2. Skip the name and phone questions with Enter - they are optional
  3. This user gets a home folder at /home/sftpuser and nothing else

One account per person is the habit that makes the log pages in this series meaningful later. A shared account means a shared blame.

5

Open the Firewall and Take the First Connection

If UFW is active, port 22 needs an explicit pass:

  1. sudo ufw allow OpenSSH
  2. sudo ufw status to confirm the rule is listed
  3. From a second machine on the same network, connect with sftp [email protected], replacing the address with your server's real IP, which ip a on the server will show you
  4. Type yes at the first fingerprint prompt only after reading the guide in this series about verifying that fingerprint - it is the check that proves you reached your server and not an impostor
  5. Inside the session, put uploads a file, get downloads one, and exit leaves

Your server is now working on the local network. Putting it on the internet is a different decision with extra rules - keys instead of passwords, and the fail2ban guide in this series - so do not forward the router port until you have read those.

🔴 Honest note: a five minute install gives you a working server, not a finished one. Password login on the open internet, users who can see the whole disk, and no login records are the three gaps the rest of this series closes one by one.

Watch the Full Video

See the whole Ubuntu SFTP setup done live, with the exact clicks and commands, in the Technical Anshu video.

Watch Full Video
Frequently Asked Questions

Is SFTP already installed on Ubuntu?

The client is, the server usually is not. Installing the openssh-server package adds the service, and SFTP comes with it as a subsystem. There is no separate SFTP package to find.

Which port does the Ubuntu SFTP server use?

Port 22, the same port as SSH, because SFTP travels inside the SSH connection. One port carries login and file transfer together, which is why the firewall step is a single rule.

Can I connect from Windows to this server?

Yes. WinSCP and FileZilla both speak SFTP and connect to an Ubuntu server with just the address, port 22, username and password or key. This series has a full guide on connecting from Windows, including the fingerprint check.

This guide is based on the Technical Anshu Ubuntu SFTP server video - Stuck on a step? Ask in the video comments and you will get a reply.