SSH reverse tunnel netstat ports

خرید بک لینک

I've a question about SSH reverse tunnel. I've an ubuntu server with sshd installed. I open ssh reverse tunnel from a remote machines, on that machine the connection is restarted every time the tunnel is interrupted.

Whenever a tunnel is opened, on the SSH server i can see two connection using netstat. One listening to the interal server port. Then other on an exteal port. The latter one is the SSH tunnel.

As example. given 138.10.20.10: my ssh server and 10.34.23.12 my remote pc, 5000 the port on my remote pc i would like to access to

ssh -R 1122:localhost:5000 [email protected]

Now server side i've two listening connections, which looks like this

tcp6    0    :::1122              :::*                 LISTEN
tcp6    0    0 138.10.20.10:22    10.34.23.12:62734    ESTABLISHED

I the nc command from the server, to check for the tunnel to work

nc -z -v -w5 127.0.0.1 122

Sometime it happens that the exteal connection dies, so my netstat will be

tcp6    0    0 138.10.20.10:22    10.34.23.12:62734    ESTABLISHED

Is there a way to check which tunnel does not have an exteal port listening?

I mean, is there a way to check when my 1122 port dies? My solution would be kill the sshd process binded to the tunnel without any exteal port (10.34.23.12:62734). The problem is that I've a other ssh tunnel on this machine I would not like to kill, so killall sshd would not be an option.

Thank you!

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: ssh reverse tunnel,ssh reverse tunnel multiple ports,ssh reverse tunnel port forwarding,ssh reverse tunnel connection refused,ssh reverse tunnel background,ssh reverse tunnel syntax,ssh reverse tunnel putty,ssh reverse tunnel not working, نویسنده: استخدام کار بازدید: 441 تاريخ: شنبه 6 شهريور 1395 ساعت: 20:38

صفحه بندی