Discussion:
ssh problem - Bind: address already in use
(too old to reply)
Anthony Campbell
2009-07-29 11:18:25 UTC
Permalink
I'm trying to set up ssh to a remote machine with:
ssh -f -L 6000:localhost:4499 ***@91.204.208.39 -N

This works on two machines without problems. On the third (sod's law -
the one I really want to use), when I type the password I get:

bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 6000
Could not request local forwarding


I have looked for port 6000 with netstat -a and lsof and nothing shows
up. All three machines are running Debian Sid. The offending one used to
work in this way a few months ago.

Any suggestions where to look for where the port is being blocked?
--
Anthony Campbell - ***@acampbell.org.uk
Microsoft-free zone - Using Debian GNU/Linux
http://www.acampbell.org.uk (blog, book reviews,
and sceptical articles)
Bambleweeny57
2009-07-29 11:36:56 UTC
Permalink
Post by Anthony Campbell
This works on two machines without problems. On the third (sod's law -
bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 6000
Could not request local forwarding
The error suggests its the machine you're logging in from that is the
problem... have you terminated the other ssh session thats using port
6000 before starting the latest one?

BTW, if the above ssh line shows your real login name you might want to
change it.

BW
--
Time is an illusion. Lunchtime doubly so.
Anthony Campbell
2009-07-29 13:16:37 UTC
Permalink
Post by Bambleweeny57
The error suggests its the machine you're logging in from that is the
problem... have you terminated the other ssh session thats using port
6000 before starting the latest one?
BTW, if the above ssh line shows your real login name you might want to
change it.
BW
No other ssh session is running. Googling shows that port 6000 is for
X11. Not sure what this means.

AC
--
Anthony Campbell - ***@acampbell.org.uk
Microsoft-free zone - Using Debian GNU/Linux
http://www.acampbell.org.uk (blog, book reviews,
and sceptical articles)
Bambleweeny57
2009-07-29 13:24:15 UTC
Permalink
Post by Anthony Campbell
Post by Bambleweeny57
The error suggests its the machine you're logging in from that is the
problem... have you terminated the other ssh session thats using port
6000 before starting the latest one?
BTW, if the above ssh line shows your real login name you might want to
change it.
BW
No other ssh session is running. Googling shows that port 6000 is for
X11. Not sure what this means.
AC
What ssh is doing is listening on a local port for traffic(6000), which
it will encrypt, fire across the session, decrypt and forward on (to
localhost port 4499) when it gets to the other end.

Your error message is saying that port 6000 on the client machine is
already in use so ssh cannot use it. Try another port 6001, 7000,
8000... whatever.

When you say "works on other machines" do you mean works when connecting
to other servers from the same client or works connecting to the same
server from other client machines?

BW
--
Time is an illusion. Lunchtime doubly so.
Anthony Campbell
2009-07-29 13:57:25 UTC
Permalink
Post by Bambleweeny57
What ssh is doing is listening on a local port for traffic(6000), which
it will encrypt, fire across the session, decrypt and forward on (to
localhost port 4499) when it gets to the other end.
Your error message is saying that port 6000 on the client machine is
already in use so ssh cannot use it. Try another port 6001, 7000,
8000... whatever.
When you say "works on other machines" do you mean works when connecting
to other servers from the same client or works connecting to the same
server from other client machines?
BW
I can't change the port; it is the one I was given to connect to.

I mean that I have two other machines with the same set-up, both of
which connect to the server using the same ssh command.

After googling 'port 6000' I find that it is the port used by X11. If I
log in at a terminal (no X started) I can connect ssh as expected. But
then, of course, I can't start X! So at the moment either I can connect
without X or I can run X but can't connect.

What I can't understand is how two other machines, both running Debian
Sid, both running X, can connect and this one can't.

AC
--
Anthony Campbell - ***@acampbell.org.uk
Microsoft-free zone - Using Debian GNU/Linux
http://www.acampbell.org.uk (blog, book reviews,
and sceptical articles)
Anthony Campbell
2009-07-29 14:17:03 UTC
Permalink
Post by Anthony Campbell
Post by Bambleweeny57
What ssh is doing is listening on a local port for traffic(6000), which
it will encrypt, fire across the session, decrypt and forward on (to
localhost port 4499) when it gets to the other end.
Your error message is saying that port 6000 on the client machine is
already in use so ssh cannot use it. Try another port 6001, 7000,
8000... whatever.
When you say "works on other machines" do you mean works when connecting
to other servers from the same client or works connecting to the same
server from other client machines?
BW
I can't change the port; it is the one I was given to connect to.
I mean that I have two other machines with the same set-up, both of
which connect to the server using the same ssh command.
After googling 'port 6000' I find that it is the port used by X11. If I
log in at a terminal (no X started) I can connect ssh as expected. But
then, of course, I can't start X! So at the moment either I can connect
without X or I can run X but can't connect.
What I can't understand is how two other machines, both running Debian
Sid, both running X, can connect and this one can't.
AC
OK, I found a way round it at

http://etutorials.org/Networking/network+security+hacks/Chapter+1.+Unix+Host+Security/Hack+9+Prevent+Services+from+Binding+to+an+Interface/

If I start X with 'startx -- -nolisten' everything works. This should
not be necessary because in /etc/X11/xinit/xserverrc there is a line
with the no-listen switch, but for some reason it is being ignored.

AC
--
Anthony Campbell - ***@acampbell.org.uk
Microsoft-free zone - Using Debian GNU/Linux
http://www.acampbell.org.uk (blog, book reviews,
and sceptical articles)
Anthony Campbell
2009-07-29 14:24:45 UTC
Permalink
Post by Anthony Campbell
Post by Bambleweeny57
What ssh is doing is listening on a local port for traffic(6000), which
it will encrypt, fire across the session, decrypt and forward on (to
localhost port 4499) when it gets to the other end.
Your error message is saying that port 6000 on the client machine is
already in use so ssh cannot use it. Try another port 6001, 7000,
8000... whatever.
When you say "works on other machines" do you mean works when connecting
to other servers from the same client or works connecting to the same
server from other client machines?
BW
I can't change the port; it is the one I was given to connect to.
I mean that I have two other machines with the same set-up, both of
which connect to the server using the same ssh command.
After googling 'port 6000' I find that it is the port used by X11. If I
log in at a terminal (no X started) I can connect ssh as expected. But
then, of course, I can't start X! So at the moment either I can connect
without X or I can run X but can't connect.
What I can't understand is how two other machines, both running Debian
Sid, both running X, can connect and this one can't.
AC
OK, I found a way round it at

http://etutorials.org/Networking/network+security+hacks/Chapter+1.+Unix+Host+Security/Hack+9+Prevent+Services+from+Binding+to+an+Interface/

If I start X with 'startx -- -nolisten tcp' everything works. This should
not be necessary because in /etc/X11/xinit/xserverrc there is a line
with the no-listen switch, but for some reason it is being ignored.

AC
--
Anthony Campbell - ***@acampbell.org.uk
Microsoft-free zone - Using Debian GNU/Linux
http://www.acampbell.org.uk (blog, book reviews,
and sceptical articles)
alexd
2009-07-30 16:21:21 UTC
Permalink
Post by Anthony Campbell
I have looked for port 6000 with netstat -a and lsof and nothing shows
up.
Try 'lsof -i -P' so it doesn't resolve port names.
--
<http://ale.cx/> (AIM:troffasky) (***@ale.cx)
17:20:31 up 85 days, 6:57, 2 users, load average: 0.36, 0.26, 0.19
A few flakes working together can unleash an avalanche of destruction
Paul Martin
2009-07-31 11:24:56 UTC
Permalink
Post by Anthony Campbell
I have looked for port 6000 with netstat -a and lsof and nothing shows
up. All three machines are running Debian Sid. The offending one used to
work in this way a few months ago.
Use "netstat -tlp" instead. That will tell you which sockets are in
listen mode, and which processes they're allocated to.
--
Paul Martin <***@nowster.org.uk>
Loading...