I have list of server names in the PuTTY saved sessions. I connected to one session and can know the IP address of the machine connected to using ifconfig
for Ubuntu and ipconfig
for Windows. But how to know the port number which has been used in to save those sessions in PuTTY while/after connecting?
I tried echo "$SSH_CLIENT"
but didn't get the right IP, so, the port might also be wrong.
ss -nlput | grep sshd
will showtcp LISTEN 0 0 *:22 *:* sshd 1234 42
-> port 22