I am interested in finding out which port number the SSH client used to send connect/authentication request to server (default on port 22).
How can I discover it?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
If you want to know what port a particular ssh connection will use, you can look in /etc/ssh/ssh_config for any system/global hosts configured, and in ~/.ssh/config for any user/local hosts.
If you want to know what port will be used by default, you can use the command
getent services ssh. The standard is to connect to port 22.
If you want to know what ports are actively in use, the command
netstat --tcp --programs --numeric | grep ssh should show you.