SSH: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have a server which has 2 IP addresses (2 NIC)
1 public
1 private
Anyway, I have always SSH in to this server, via the private ip from another server. In fact, I can ssh into this server via another server even if I use the public IP.
Problem is, now I can't access the server via the public ip directly (over internet etc)
in /var/logs/secure, I am getting...
Quote:
error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
I've tried ssh localhost from the same machine and it works.
I even try uncommenting the line that specify it to search for IPv6 in sshd_config and still it doesn't work.
Have restarted service etc.. nope
Now left to reset the machine, which I will be doing tommorrow morning when lesser people are using it... but any idea?
netstat output (removed public ips) In between got a space because there's more similiar entrees but I thought I cut short. Also *** is to mask the ip address.
Quote:
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN
tcp 0 0 192.168.10.60:53 0.0.0.0:* LISTEN
tcp 0 0 ***.***.***.***:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN
tcp 0 0 192.168.10.60:3306 192.168.10.206:54792 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.60:32797 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.60:32798 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54805 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.60:32790 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.60:32786 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.208:35422 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.208:35415 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.208:35407 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54623 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54627 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.208:55677 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.208:55676 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54633 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54632 ESTABLISHED
tcp 0 0 192.168.10.60:32790 192.168.10.60:3306 ESTABLISHED
tcp 0 0 192.168.10.60:32786 192.168.10.60:3306 ESTABLISHED
tcp 0 0 192.168.10.60:32798 192.168.10.60:3306 ESTABLISHED
tcp 0 0 192.168.10.60:32797 192.168.10.60:3306 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54636 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54897 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54640 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54899 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54898 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.208:35436 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54901 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54647 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.208:35433 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54651 ESTABLISHED
tcp 0 0 192.168.10.60:3306 192.168.10.206:54650 ESTABLISHED
I'll be damm... I'm sure even with iptables OFF it wasn't working before... (SSH and FTP).. but i did a reset a couple of days back, but didn't thought of trying to turn off the iptables... now it works...
I'll be damm.
Nonetheless, thanks for your help!
since we are on the topic, can I ask 2 things?
1) lsof list open files you were saying. we use that to check for connections becase sockets are basically file descriptors?
2) i always find iptables configuration a big mystery, you reckon any good tutorials i can base on to configure my own?
Is it ok i configure iptables config file directly?
2) i always find iptables configuration a big mystery, you reckon any good tutorials i can base on to configure my own?
Is it ok i configure iptables config file directly?
If you find the above also difficult, try using some gui frontends such as firestarter,etc. Or may be other commnad line utilities(firewalls) to configure a proper firewall may be something like shorewall??
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.