0

Ok,

so here's the deal. I setup an Iptables rule as follows:

IPTABLES -A INPUT -p tcp --dport 51722 -j ACCEPT

and if I do systemctl status sshd.service, I get the following:

Server listening on 0.0.0.0 port 51722.

Ok. That's what I want. I then ssh as such ssh -p 51722 [email protected]

once I login, I check status of sshd again and notice.

Accepted password for root from MY.IP.ADDRESS port 49344 ssh2

Why is it showing that it is on Port 49344 as opposed to 51722?

1 Answer 1

1

This is because ssh uses ephemeral ports.The logged port is port that the client is using to connect, not the port the server accepted the connection on.

Your netstat -tp output will have a line similar too:

tcp    0    0 server.example.com:51722    client.example.com:49344    ESTABLISHED 15825/sshd
1
  • ah, ok cool. didn't know about ephemeral ports. Commented Mar 9, 2015 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .