Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning: remote port forwarding failed for listen port 52698

Tags:

openafs

I'm using SSH to access my university's afs system. I like to use rmate (remote TextMate), which requires SSH tunneling, so I included this alias in my .bashrc.

alias sshr=ssh -R 52698:localhost:52698 [email protected]

It has always worked until now.

like image 880
Rose Perrone Avatar asked Aug 05 '12 16:08

Rose Perrone


People also ask

What is remote port forwarding?

This form of port forwarding enables applications on the server side of a secure shell. There are proprietary for the same general purpose. To use remote port forwarding the address of the destination server and two port number must be known.

What is reverse SSH port forwarding?

Remote port forwarding (reverse tunneling) Also often called SSH reverse tunneling, remote port forwarding redirects the remote server's port to the localhost's port. When remote port forwarding is used, at first, the client connects to the server with SSH.

What is tunnel SSH?

SSH tunneling, or SSH port forwarding, is a method of transporting arbitrary data over an encrypted SSH connection. SSH tunnels allow connections made to a local port (that is, to a port on your own desktop) to be forwarded to a remote machine via a secure channel.


4 Answers

I had the same problem. In order to find the port that is already open, you have to issue this command on the 'corn.myschool.edu' computer:

sudo netstat -plant  | grep 52698

And then kill all of the processes that come up with this (replace xxxx with the process ids)

sudo kill -9 xxxx

(UPDATED: changed the option to be -plant as it is a nice mnemonic)

like image 186
Mark Lakata Avatar answered Oct 05 '22 19:10

Mark Lakata


I had another SSH connection open. I just needed to close that connection before I opened my SSH tunnel.

Further Explanation: Once one ssh connection has been established, subsequent connections will produce a message:

Warning: remote port forwarding failed for listen port 52698

This message is harmless, as the forward can only be set up once and one forward will work for all ssh connections to the same machine. The original ssh session that opened the forward will stay open when you exit the shell until all remote editing sessions are finished.

like image 20
Rose Perrone Avatar answered Oct 05 '22 18:10

Rose Perrone


I experienced this problem, but it was while connecting to a server on which I don't have sudo priviliges, so the top response suggesting runing sudo netstat ... wasn't feasible for me.

I eventually figured out it was because there were still instances of rmate running, so I used ps to list the running processes and then kill -9 pid (where pid is the process ID for rmate).

like image 39
Lachlan Hunt Avatar answered Oct 05 '22 20:10

Lachlan Hunt


This solved my problem reported here as well. To avoid this notification "AllowTcpForwarding" should be enabled in SSH config.

like image 44
dxtr80 Avatar answered Oct 05 '22 19:10

dxtr80