50

我正在使用 SSH 访问我大学的 afs 系统。我喜欢使用 rmate(远程 TextMate),它需要 SSH 隧道,所以我在我的.bashrc.

alias sshr=ssh -R 52698:localhost:52698 username@corn.myschool.edu

它一直有效到现在。

4

5 回答 5

62

我有同样的问题。为了找到已经打开的端口,您必须在“corn.myschool.edu”计算机上发出以下命令:

sudo netstat -plant  | grep 52698

然后杀死所有提出这个的进程(用进程ID替换xxxx)

sudo kill -9 xxxx

(更新:将选项更改-plant为很好的助记符)

于 2013-01-29T23:54:44.877 回答
31

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.

于 2012-08-05T16:39:14.767 回答
3

这也解决了我在这里报告的问题。为避免此通知,应在 SSH 配置中启用“AllowTcpForwarding”。

于 2019-01-27T18:28:32.083 回答
3

我遇到了这个问题,但它是在连接到我没有 sudo 权限的服务器时,所以建议运行的最高响应sudo netstat ...对我来说是不可行的。

我最终发现这是因为仍然有 rmate 的实例在运行,所以我曾经ps列出正在运行的进程,然后kill -9 pid(其中 pid 是 rmate 的进程 ID)。

于 2017-09-18T13:46:10.110 回答
0

就我而言,问题在于远程系统没有正确设置 DNS,甚至无法解析自己的主机名。确保您在远程系统的 /etc/resolv.conf 中有一个可用的 DNS。

于 2013-08-26T09:10:15.420 回答