ssh, sftp, scp, tftp port fun

To start an SSH session on a specific port:

$ ssh -p 22222 host

To download a file over SCP on a unique port:

$ scp -P 22222 host:file .

To start an SFTP session on a specific port:

$ sftp -oPort=22222 host

To start an tftp session on a specific port:

$ tftp host 22222

Hashtag Linux userland! Time to break out some port of another nature.

UPDATE: I wrote about SFTP ports seven years ago. I guess my memory is worse than I thought, though at least it hasn’t affected my memory.


This is one of about 5000 posts on Rubénerd. View the home page for the latest, or related posts also tagged with:

If you liked this post, feel free to buy me a coffee, leave me a comment on Twitter, or email me at Thanks :).