Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Trying ssh -p 51685 seems to change the port that I'm trying to connect to, not my outgoing port.

As does editing ssh_config.

I want to change my outgoing port from 22 (which is blocked) to 51685.

Any ideas?

share|improve this question
    
Maybe I'm missing something obvious, but what is wrong with the two approaches you list yourself? –  Michael Kjörling Feb 25 '11 at 13:30
    
@Michael: the two methods he lists change the destination port, not the source port. –  David Spillett Feb 25 '11 at 14:01
2  
Odds are, the corporate firewall you're trying to circumvent is doing packet inspection and is blocking traffic DESTINED for 22. See Dave's answer below. –  peelman Feb 25 '11 at 16:01
add comment

2 Answers

Outgoing connections do not use fixed port assignments, they choose an available port number, usually higher than 1024. More to the point, unless you are running as root (the admin user account, which is disabled by default on OSX), you cannot open an outgoing connection on port 22 because only root is allowed to open any ports below 1024. Therefore, if you're running ssh and are not root at the time, you're definitively not using port 22 for outgoing connections.

Whatever issue you're having, you have incorrectly identified its cause.

share|improve this answer
add comment

Are you sure it is the source port that is being filtered? Clients usually use an arbitrary source port (between 1024 and 65535) not the protocol's assigned port, and if your connection passes through any NAT arrangements on the way between you and the server (or the device that is doing the blocking) the original source port will be "lost" anyway so source port based filtering isn't usually very useful anyway.

For instance I've just made a fwe connections using PuTTY and OpenSSH to one of my servers, and wireshark tells me that the source ports for the connections where 6525, 6535, 6560 and 6562.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.