Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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