How do I determine the outgoing port being used by SSH after connecting? [closed]

StackOverflow https://stackoverflow.com/questions/20821760

  •  22-09-2022
  •  | 
  •  

Вопрос

I have connected to a remote server using ssh:

ssh -i <keypair> <user@server>

How do I determine the outgoing port that my ssh client is using to connect to the remote server ?

I want to know so that I can setup my VNC Client to use that port...

NOTE: I am not talking about the port on the remote server!

Это было полезно?

Решение

Look at the variable $SSH_CLIENT - the second number is the client port.

Другие советы

Should you want to know it from the client side, you can run this command

lsof -p pid | grep TCP

with pid being the process ID of the ssh command

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top