Back to blog
SFTP port article cover
SFTP4 min read

What is the SFTP port, and why does it fail to connect?

This guide explains the default SFTP port, why SFTP uses the same port as SSH, and the most common reasons SFTP connections fail in real server workflows.

A lot of people first run into SFTP because they need to transfer files to a server. The command looks simple, but once it fails, the questions start immediately: is the port wrong, is the service down, or is the protocol itself misunderstood?

That is why “what is the SFTP port” remains such a common search. The real answer is not just one number. It is understanding how SFTP relates to SSH in the first place.

Start with the answer: the default SFTP port is 22

In most environments, the default SFTP port is 22. That is also the default port used by SSH.

So when you run `sftp user@server`, what actually happens is an SSH connection attempt to the default port, followed by activation of the SFTP subsystem. If no port is specified, the client will always try 22 first.

Why you see Connection refused

The most common scenario is simple: the server is not listening on 22 anymore, but your client is still trying to use the default. For example, if the server moved SSH to port 2222 and you still run `sftp [email protected]`, the client will first try 22.

If no SSH service is listening there, the result is `Connection refused`. It looks like an SFTP problem, but in reality it is just the wrong SSH port.

  • The client assumes port 22 unless told otherwise
  • The server may actually be listening on 2222, 22000, or another custom port
  • Any mismatch leads to immediate failure
  • The correct fix is to specify the actual port, for example `sftp -P 2222 user@server`

Why SFTP and SSH use the same port

Many people assume SFTP is simply “encrypted FTP” and therefore should have its own standalone port. That is not how it works.

SFTP stands for SSH File Transfer Protocol. It is an SSH subsystem, not an independent transport protocol. That means it only starts after an SSH connection has already been established.

If SSH cannot connect, SFTP cannot connect either.

The three most common causes of SFTP failures

In practice, most SFTP connection failures fall into a small set of categories. The symptoms vary, but the root causes are usually familiar.

  • Wrong port: the server changed its SSH port, but the client is still using 22
  • Firewall or security group blocking: the request never reaches the server
  • SSH or SFTP misconfiguration: sshd is not running, or the SFTP subsystem is not enabled correctly

Why this keeps happening

Most people follow a similar path: they get a server, need file transfer, then search through FTP, SCP, and SFTP advice. When there is only one machine, one command is usually enough.

But once you have multiple servers using different ports, users, and protocols, the challenge stops being command syntax and becomes connection management.

  • Server A uses 22
  • Server B uses 2222
  • Server C uses 22000
  • Over time it becomes harder to remember which server uses which parameters

The real pain is not the command. It is the connection details.

When server count is low, the command line is perfectly fine. But once you are repeatedly typing ports, hosts, usernames, and protocols, the manual overhead starts to matter.

At that point, people end up storing the information in notes, spreadsheets, or separate tools. The real efficiency problem is no longer SFTP itself. It is the way those connection details are managed.

A more practical approach: manage connection info in one place

The more sustainable answer is not retyping `sftp -P 2222 user@server` every time. It is saving the host, port, username, and protocol once and reusing them when needed.

That is where integrated remote tools like DartShell become useful. They centralize SSH, SFTP, RDP, database, and other connection details into one workspace, which reduces repetition and lowers the chance of mistakes.

Bottom line

The default SFTP port is 22, and that part is straightforward. The more important thing to understand is that SFTP depends on SSH, so troubleshooting SFTP almost always means troubleshooting the SSH path underneath it.

If a connection fails, check whether the port was changed, whether the firewall allows it, and whether SSH/SFTP is configured correctly. And once the number of connections grows, centralizing those details in one remote management tool usually saves a lot of time.

DartShell

Want SSH, SFTP, and other remote access details managed in one place?

Use DartShell to organize hosts, ports, protocols, and connection details without retyping everything each time.

Download DartShell