archive 2022 ► SSH-Ports

Ports for ssh, scp, rsync

Date: 2022-01-07

Have to look1 this2 up3 every time4:

Assuming you’re connected to a machine like


and want to transfer files afterwards, you’ll likely update your recent command to

scp dest/folder


rsync -a dest/

for copying said files. So far, so good.

When relying on ports, this gets way more complicated due to differing parameter styles for each command which are

# `-p[port]`
ssh -p222

# `-P [port]`
scp -P 222 dest/folder

# set port on custom remote shell
rsync -a -e "ssh -p222" dest/folder

(Note that rsync has more options for defining TCP daemon ports with --port=[PORT] which is probably not what you want)

You’re welcome!

  1. ssh manpage↩︎

  2. scp manpage↩︎

  3. rsync manpage↩︎

  4. Find offline documentation tools on Stackoverflow … or use Dash on Macs and Zeal man docsets on Windows↩︎

© 2020–22 Studio Agenturbüro — contact@studioagenturbuero.deimprint, legal, image credits.