VibeWare

Guides/File transfer

How to connect to an SFTP server from Windows

The short answer

Windows 10 and 11 can connect to SFTP servers with the OpenSSH client's sftp command. Open Terminal or Command Prompt and type sftp username@server.example.com, answer yes to the host key question the first time, then enter your password. For another port use sftp -P 2222 username@server.example.com. If the command is not found, add OpenSSH Client under Optional features in Settings.

Windows 10 (from build 1809) and Windows 11 have an OpenSSH client, available as an optional feature, and it includes a command called sftp. This page shows how to check that it is there and how to use it.

Check that sftp is there

Open Terminal, PowerShell or Command Prompt and type:

sftp

If you see a block of text starting with usage: sftp, you are set. If Windows says the command is not recognized, add the client. Microsoft lists an administrator account as a requirement for this:

  1. Select Start, type Optional features and open it.
  2. On Windows 11, select View features, search for OpenSSH Client, select it and choose Add. On Windows 10, select Add a feature, search for OpenSSH Client and choose Install.

You only need the client. OpenSSH Server is a different feature, for letting others connect to your PC.

The same thing from PowerShell, run as administrator:

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

OpenSSH is available on Windows 10 from build 1809 and on Windows 11.

Connect

Go to the folder on your PC that you want to send files from or save files to, then start sftp with your username and the server’s name:

cd C:\Users\you\Documents\site
sftp username@server.example.com

The first time you connect to a server you get a question like this:

The authenticity of host 'server.example.com (203.0.113.10)' can't be established.
ED25519 key fingerprint is SHA256:...
Are you sure you want to continue connecting (yes/no)?

This is the server showing its host key. SSH uses that key to prove that you are talking to the right machine. If the server’s administrator gave you a fingerprint, compare it. Type yes to continue, and Windows remembers the key for next time. If you ever get a warning that the key has changed, stop and ask the administrator before going on.

Then type your password. Nothing shows on screen while you type. That is normal.

When it works you see the prompt:

sftp>

Another port or a key file

SSH servers normally listen on port 22. If yours uses a different one, pass it with -P (a capital P):

sftp -P 2222 username@server.example.com

To log in with a private key file instead of a password, use -i:

sftp -i C:\Users\you\.ssh\id_ed25519 username@server.example.com

Move files

At the sftp> prompt you type short commands. “Remote” means the server, “local” means your PC.

Command What it does
pwd Show the current folder on the server
ls List the current folder on the server
cd folder Change folder on the server
lpwd Show the current folder on your PC
lls List the current folder on your PC
lcd folder Change folder on your PC
get file.zip Download a file
put file.zip Upload a file
get -R folder Download a folder and everything in it
put -R folder Upload a folder and everything in it
get -a file.zip Resume a download that was cut off
mkdir folder Create a folder on the server
rename old new Rename a file on the server
rm file.zip Delete a file on the server. There is no recycle bin.
help List all commands
bye Disconnect

A short session looks like this:

sftp> cd public_html
sftp> put index.html
sftp> get backup.zip
sftp> bye

put and get overwrite a file of the same name on the other side without asking, so check with ls or lls first if you are unsure.

If it does not connect

  • Connection refused or timed out. Check the host name and the port. Port 21 is FTP, not SFTP. Your network or the server’s firewall may also block port 22.
  • Permission denied. The username, password or key is wrong, or the server does not allow that kind of login.
  • The server wants FTPS, not SFTP. They are different protocols, and sftp only speaks SFTP. See SFTP vs FTPS.

Windows also has an older ftp command. It connects to FTP servers only, and its documentation lists no option for encryption, so it is no substitute.

With VibeFTP

The sftp command is fine for a quick upload. For browsing around or moving many files it gets slow to type. VibeFTP is a free, open-source client for Windows that does the same job in a window.

  • Open Sites, press New site, keep Protocol on SFTP, fill in Host and Username, and press Connect.
  • It shows the server’s key fingerprint the first time and remembers it. A changed key later stops the connection and asks you.
  • Your PC is on the left and the server on the right. Select files and press F5, or drag them across.
  • A saved password goes to Windows Credential Manager. A private key is picked with Browse.
  • Press Enter on a remote file to edit it in your own editor. Each save is uploaded.

VibeFTP is a preview release and needs no administrator rights.

Questions people ask

How do I connect to an SFTP server from the Windows command prompt?

Type sftp username@hostname and press Enter. The first time, confirm the server's key fingerprint with yes, then type your password. You get an sftp> prompt where commands like ls, get and put work.

Does Windows 11 have a built-in SFTP client?

Yes, as a command-line tool. The sftp command is part of the OpenSSH Client feature of Windows. There is no SFTP support in the old ftp command, which only speaks plain FTP.

What port does SFTP use?

SFTP runs over SSH, and SSH servers normally listen on port 22. If your server uses another port, pass it with a capital P: sftp -P 2222 username@hostname.

How do I connect to SFTP with a private key on Windows?

Point sftp at the key file with -i, for example sftp -i C:\Users\you\.ssh\id_ed25519 username@hostname. If the key has a passphrase you are asked for it.

How do I upload a file with SFTP on Windows?

Connect, then type put followed by the file name, for example put report.pdf. The file is sent from the folder you started sftp in to the current folder on the server. Use get to download.

Sources

VibeWare is not affiliated with Microsoft, OpenSSH, or OpenBSD. What this page says about them comes from their own pages, linked above.

Published · by Ted K. Johansen, who also makes VibeFTP