Markus Blog What's going on Internet?

5Dec/074

Error: “bind to port 22 on 0.0.0.0 failed: Address already in use”


Yesterday I setup a Linux Centos server which then having problem with connection refused/dropped when I configuring it via SSH.I check the sshd log file, and see “Error: bind to port 22 on 0.0.0.0 failed: Address already in use” error message. Some web page I read said that it’s because IPv4 and IPv6 are both configured to listen SSH, we need to turn off one. Here is how to fix it:

/etc/ssh/sshd_config

Look for

Port 22
Protocol 2
#ListenAddress 0.0.0.0
#ListenAddress ::

If you use IPv4, uncomment this line:

ListenAddress 0.0.0.0

So it look like this:

Port 22
Protocol 2
ListenAddress 0.0.0.0
#ListenAddress ::

For IPv6, uncomment this one:

ListenAddress ::

So it look like this:

Port 22
Protocol 2
#ListenAddress 0.0.0.0
ListenAddress ::
Bookmark and Share

Most Commented Posts

Comments (4) Trackbacks (0)
  1. I’ve spent hours trying to find out… and it works like a charm now! Thanks!

  2. It’s not working for me, I still have this error :-(

  3. @China P, what OS are you using? is it centos? have you tried restarting the sshd after you make the changes?

  4. Thanks a mill Markus works perfectly. Thanks a mill!


Leave a comment

(required)


*

No trackbacks yet.