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?


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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.