Updated: 30 September 2026 · Applies to: OpenSSH clients on Linux, macOS and Windows 10 and 11, PuTTY 0.85, FileZilla and WinSCP

SSH uses port 22 unless the server is set up differently. If your server’s SSH runs on another port (for example 2222), every tool needs to be told the port, and each tool spells the option a little differently. To change the port on the server itself, see the default SSH port and how to change it safely.

ssh

ssh -p 2222 user@server.example.com

scp and sftp: capital P

scp -P 2222 file.zip user@server.example.com:/home/user/
scp -r -P 2222 site user@server.example.com:/var/www/
sftp -P 2222 user@server.example.com

rsync

rsync -avz -e "ssh -p 2222" site/ user@server.example.com:/var/www/site/

Save the port once: ~/.ssh/config

Host myserver
    HostName server.example.com
    Port 2222
    User user

Then ssh myserver, scp file.zip myserver: and rsync -avz site/ myserver:/var/www/site/ all use port 2222 without extra options. VS Code’s Remote - SSH extension reads this file too.

PuTTY (Windows)

  1. In Session, enter the host name and change Port from 22 to your port.
  2. Keep Connection type on SSH, type a name under Saved Sessions and click Save.

FileZilla and WinSCP

  • FileZilla: in Site Manager choose protocol SFTP and enter the port, or type sftp://server.example.com and the port in the Quickconnect bar.
  • WinSCP: choose SFTP and change Port number on the login screen.

If the connection fails

  • Connection refused: nothing listens on that port; check the port number with your host.
  • Timed out: a firewall blocks the port.

We tested the OpenSSH commands against a Ucartz VPS. More: copy folders with scp and access your server with PuTTY.

Ucartz services for this topic

Was this answer helpful? 2 Users Found This Useful (9 Votes)