ssh server hangs the port even if client machine shuts down

Adriana Rodean adrya1984 at gmail.com
Thu Jul 1 16:47:47 EST 2010


Hi,

I have the following problem with ssh, hope someone can help me with it:

I have 2 processes of ssh server on same Linux machine. One of them is
the normal ssh configuration for Linux, the other one starts with a
custom configuration on another port.
>From the client i do a remote port forwarding to the custom ssh
server: ssh  -R 1037:localhost:55555.

After this command on ssh server process list i see:

sshd      29996                             root    3r  IPv4
1310919488       TCP 10.55.41.92:2233->10.55.40.121:2481 (ESTABLISHED)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    3u  IPv4
1310919488       TCP 10.55.41.92:2233->10.55.40.121:2481 (ESTABLISHED)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    7u  IPv4
1310919539       TCP 127.0.0.1:1037 (LISTEN)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    8u  IPv6
1310919540       TCP [::1]:1037 (LISTEN)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    9u  IPv4
1310919596       TCP 127.0.0.1:48818->127.0.0.1:http-alt (ESTABLISHED)

Then after awhile:

sshd      29996                             root    3r  IPv4
1310919488       TCP 10.55.41.92:2233->10.55.40.121:2481 (ESTABLISHED)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    3u  IPv4
1310919488       TCP 10.55.41.92:2233->10.55.40.121:2481 (ESTABLISHED)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    7u  IPv4
1310919539       TCP 127.0.0.1:1037 (LISTEN)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    8u  IPv6
1310919540       TCP [::1]:1037 (LISTEN)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    9u  IPv4
1310919596       TCP 127.0.0.1:48818->127.0.0.1:http-alt (CLOSE_WAIT)

Then after awhile:

sshd      29996                             root    3r  IPv4
1310919488       TCP 10.55.41.92:2233->10.55.40.121:2481 (ESTABLISHED)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    3u  IPv4
1310919488       TCP 10.55.41.92:2233->10.55.40.121:2481 (ESTABLISHED)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    7u  IPv4
1310919539       TCP 127.0.0.1:1037 (LISTEN)
sshd      30000 615da7706d6c4babbcd6e6fb867ddab1    8u  IPv6
1310919540       TCP [::1]:1037 (LISTEN)

When client shuts down computer, i noticed that the 1037 port is still
listening on the server, but its PID changed.
So even when the client computer is completely shut down => no
connection with the ssh server, on the ssh server i have:

sshd      32025                             root    3r  IPv4
1310943105       TCP 10.55.41.92:2233->10.55.40.121:2485 (ESTABLISHED)
sshd      32029 615da7706d6c4babbcd6e6fb867ddab1    3u  IPv4
1310943105       TCP 10.55.41.92:2233->10.55.40.121:2485 (ESTABLISHED)
sshd      32029 615da7706d6c4babbcd6e6fb867ddab1    7u  IPv4
1310943156       TCP 127.0.0.1:1037 (LISTEN)
sshd      32029 615da7706d6c4babbcd6e6fb867ddab1    8u  IPv6
1310943157       TCP [::1]:1037 (LISTEN)


Problem is when client opens computer again (after shut down/restart)
it isn't able to connect with same command: ssh  -R
1037:localhost:55555 because that port is still listening on the
server :(
It takes long time to be able to connect again to server, sometimes
even 2 hours :(

Why the port still listens on the server even if no client is
connected to it? (client pc is closed)
How can we solve this problem?
I want that process with the client port to be closed when client
shuts down PC, so client after restart be able to reconnect with same
command when PC is up again...

Thank you,
Adriana


More information about the openssh-unix-dev mailing list