SCP and SFTP Cheat Sheet/Connect to SFTP on a custom port

Specify a non-default SSH port for SFTP.

Section: sftp Basics

Connect to SFTP on a custom port

bash
bash
sftp -P 2222 user@example.com
Explanation

Specify a non-default SSH port for SFTP.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing sftp Basics
Open an SFTP session
Start an interactive SFTP shell.
OpenIn sheetbashsame section
Run SFTP in batch mode
Execute SFTP commands from a batch file.
OpenIn sheetbashsame section
Resume an interrupted download
Continue downloading a partially transferred file.
OpenIn sheettextsame section
Resume an interrupted upload
Continue uploading a partially transferred file.
OpenIn sheettextsame section
Upload within interactive sftp
Put a file during an interactive session.
OpenIn sheettextsame section
Download within interactive sftp
Get a file during an interactive session.
OpenIn sheettextsame section