My Ubuntu runs ssh on port 22. But my /var/log/auth.log says different port numbers when connections are made. And the port numbers are seemingly random:

Connection from xxx.xxx.xxx.xxx port 33692
Connection from xxx.xxx.xxx.xxx port 32970

Why are these port numbers not 22? And is there a pattern behind which port numbers are picked?

1 Answer 1


That's the remote port, not the local port. The remote OS picks a random number in a high range for the SSH client to bind to, then the client connects to port 22 on the server.

  • 3
    Are there any resources out there that explain in more detail how this works?
    – David Xia
    Feb 19, 2012 at 9:44

You must log in to answer this question.

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