Link to home
Start Free TrialLog in
Avatar of mactfines
mactfinesFlag for Afghanistan

asked on

Specify outbound port with ssh?

I am ssh'ing to a remote server, which is listening on the standard port 22, using a no-frills "ssh user@hostname.com" command to connect.

I would like to specify the outbound port my system uses to connect.  By default it gets a normal system-assigned port like 55129, etc.  Is there a way to tell ssh to use a specific outbound port?

Reading the man pages and googling, I found the -R and -L options for forwarding, which are useful for tunnelling.  I can specify my bind address with "-b <address>" and the remote port to connect to with "-p <port>".  

But I can't see where to specify the outgoing port I want ssh to use.  I want to do this so I specify on the remote system to only allow incoming connections from specific ports on the clients.

Is this possible?

Thanks,
Ted
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

use the -p portno option
ASKER CERTIFIED SOLUTION
Avatar of flob9
flob9
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial