Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
sshd[3164]: Server listening on :: port 22.
sshd[3164]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
I looked in some old post and it stated the following in one:
"is that sshd tries to bind port 22 using IPv6 first and next tries to bind port 22 on the IPv4 address in case the first attempt failed. If the first attempt was successful, then the second attempt fails due to the port already being bound. If you set a specific IP address in the "ListenAddress" directive of the sshd_config file, then you shouldn't get the error."
What is the command format to use in the "sshd_config" file set the "ListenAddress"? And would this be the solution to this problem?
I looked in some old post and it stated the following in one:
"is that sshd tries to bind port 22 using IPv6 first and next tries to bind port 22 on the IPv4 address in case the first attempt failed. If the first attempt was successful, then the second attempt fails due to the port already being bound. If you set a specific IP address in the "ListenAddress" directive of the sshd_config file, then you shouldn't get the error."
What is the command format to use in the "sshd_config" file set the "ListenAddress"? And would this be the solution to this problem?
To answer your last question first: No one can tell (on the info given). Whether the post that you have quoted is actually true in your case is unknown because that degree of detail of set-up is particular to the distro and version. So if the poster was talking about WonderWare 10.0 and you actually have MagicUX 15.372 they could be totally different. In fact even MagicUX 15.372 and MagicUX 14.999 aren't necessarily the same. MagicUX 15.372 is probably more likely to have the ipv6 stuff in by default than 14.999, but some earlier iteration will not have and there may be some intermediate iterations for which it depends on how you configure networking at install.
On the other hand, you can simply look up what is going on and put it right. This seems the better option, but YMMV.
So, firstly you need to know who has got hold of the port that you want. netstat is the command you want here, but the exact operation of netstat switches can throw you a bit at first. Try
netstat -na|grep :22
which should tell you if someone has grabbed the port (and maybe some other stuff that happens to have :22 somewhere on the line)
You can do this as an ordinary user, but to get the info that you really want, you have to be root (or use sudo) and execute
netstat -pantu|grep :22
This should tell you which process has grabbed the port (if you don't run as root it will likely not identify the stuff you want - if nothing at all shows up, omit the grep part and have a look at everything) and then you just have to alter the conf for that process OR alter things in the start up so that process doesn't run (I'm being vague about the details of how you do this as they are distro-specific).
that tells you that something is listening on port 22, and with that happening nothing else can use that port to listen on.
However, the line
Quote:
tcp 0 0 :::22 :::* LISTEN 3154/sshd
tells you what process is listening on that port, and it is sshd. In other words the daemon for the ssh service is already listening on this port. So I think what is going on is that somewhere in the distro's start up arrangement, it is already starting up ssh and you are trying to start a second copy (which obviously doesn't work because of the contention over a single port, and it wouldn't be useful if it did.)
So, I think you have less of a problem than you though you had. You already have sshd running. You can test this supposition with
ps -ef|grep ssh
which return a list of tasks running, which include the string 'ssh' in the name. One of these will probably be the ps command itself, but, if I'm right, there should also be an entry for sshd, the ssh daemon.
I rebooted after I stopped the sshd service in the "System>Administration>Server Settings>Services". Then ran the commands over again and printed the following:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.