Warning: remote port forwarding failed for listen port 52698

无人久伴 提交于 2020-11-30 02:28:08

问题


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 username@corn.myschool.edu

It has always worked until now.


回答1:


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)




回答2:


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.




回答3:


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).




回答4:


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




回答5:


In my case, the problem was that the remote system didn't have DNS properly set up, and it couldn't even resolve its own hostname. Make sure you have a working DNS in /etc/resolv.conf at the remote system.



来源:https://stackoverflow.com/questions/11818131/warning-remote-port-forwarding-failed-for-listen-port-52698

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!