May 1, 2003
How do I set my outgoing SSH port, I would have thought it would been port 22, just as it is by default incoming, but looking at my firewall logs, its blocking my outgoing SSH connections, which always have a source port of a random high range number.

Google seems to be a pain in the butt searching for "outgoing ssh port" or "source ssh port" with all the tunnelling threads, otherwise I would have fixed this by now.

I had changed my incoming SSH port to a non standard port, but reverting it to port 22 did not solve anything (no surprise there), is there some configuration I can set? Do other people have their SSH outgo with port 22 or does it use a random high range like mine? I obviously do not want to disable the firewall or allow all outgoing ports if I only need to allow one port.

Thank you.


Well-Known Member
Verifed Vendor
Jun 15, 2002
Go on, have a guess
Doesn't work like that. Your ssh connection will be going out on port 22 unless you change it with the -p switch on the remote server, you will always have an ephemeral local port that you're connecting from. You should only need port 22 TCP outgoing open in your firewall for it to work.