How-to

What Is SFTP?

SFTP is the secure way to move files to and from a server. It uses the SSH connection you already have, so it needs no extra software, ports or certificates.

What is SFTP in one paragraph?

SFTP stands for SSH File Transfer Protocol. It lets a client list, upload, download, rename and delete files on a remote machine, with everything encrypted and authenticated by SSH. Because it rides on SSH, logins use the same passwords or keys as a shell login, and the same port, 22 by default. On a dedicated server, SFTP is the natural replacement for FTP: it is already installed, already running and already secure.

How does it compare with other transfer methods?

MethodEncryptionPortsNotes
FTPNone21 plus a range of data portsPasswords and files in plain text; avoid on the internet
FTPSTLS21 or 990 plus data portsNeeds certificates and firewall care for data ports
SFTPSSH22, one portInstalled with OpenSSH; keys or passwords
SCPSSH22Command-line copies; now uses SFTP underneath
rsync over SSHSSH22Sends only differences; best for syncing

The single-port design is a practical advantage. FTP and FTPS open separate data connections on negotiated ports, which complicates firewalls and NAT. SFTP needs one TCP port that you have already opened for SSH.

Is SFTP just FTP with encryption bolted on?

No. Despite the similar name, SFTP is not FTP with encryption added. It is a separate protocol designed for SSH, with its own operations, and FTP clients cannot speak it unless they specifically support SFTP, which most popular graphical clients do. FTPS, by contrast, is FTP wrapped in TLS. The internal design of SFTP is described in How SFTP works.

What is SFTP used for on servers?

  • Deploying and editing websites: designers and developers upload files with a graphical client.
  • Partner data exchange: suppliers drop CSV or XML files nightly; you pick them up with a script.
  • Backups: many backup tools, such as restic and rclone, can store data on any SFTP server.
  • Log and report collection: pulling exports from several machines to one place.
  • Large file delivery: sharing media or data sets with customers who have their own login.

For drop boxes and partner accounts, a storage-heavy model such as those on Storage servers works well, since uploads arrive as inbound traffic, which is free.

What do I need to start?

Very little. On the server: the OpenSSH server, which every image we install already runs, and a user account. On the client: the sftp command, included with Linux, macOS and Windows 10 or later, or a graphical client. Then connect with sftp user@your-address. The step-by-step walk-through is in Use SFTP step by step, and the full list of commands in SFTP commands reference.

How secure is it?

As secure as the SSH setup behind it. Use keys rather than passwords for regular accounts, keep OpenSSH updated, and restrict file-transfer-only accounts so they cannot open a shell. A chrooted, SFTP-only account confines a partner to one folder, as shown in SFTP vs SSH. Every connection is encrypted with the same modern ciphers as an SSH login, and edge DDoS filtering in front of every machine absorbs floods aimed at the port.

Does SFTP work with automation?

Yes. The command-line client has a batch mode, curl and libcurl can upload over SFTP, and libraries exist for every major programming language, such as Paramiko for Python. Because authentication uses SSH keys, unattended jobs need no stored passwords; give each job its own key and restrict it on the server.

Are there limits?

SFTP transfers whole files and does not compare contents, so repeated syncs of large trees are better done with rsync. It also has no built-in quota system; limit space with file system quotas or separate partitions. For one-off copies from a terminal, scp is quicker to type; see The scp command.

Keep Reading

How SFTP works

Inside SFTP: the SSH subsystem request, protocol version 3, handles and request ids, pipelined reads and the OpenSSH extensions.

Open

Use SFTP step by step

Connect, browse, upload, download and resume with the sftp client, run batch jobs and use graphical clients on Windows and macOS.

Open

SFTP vs SSH

SFTP is a file transfer subsystem that rides inside SSH; learn when to hand someone SFTP only and how to jail them.

Open

Storage servers

From 8 TB mirrors to a six-drive NVMe array of more than 90 TB raw, with ZFS or mdadm laid out by you.

Open

FAQ

Quick Answers

SSH File Transfer Protocol.

The SSH port, 22 by default, and only that one port.

No. FTPS is FTP wrapped in TLS; SFTP is a separate protocol carried inside SSH.

No. OpenSSH provides SFTP on every image we install.

Yes. Tools such as restic and rclone can store backups on any SFTP server.