在文件浏览器中:通过其他 ssh 服务器连接到 ssh 服务器

在文件浏览器中:通过其他 ssh 服务器连接到 ssh 服务器

在我的文件浏览器中,我无法远程连接到位于防火墙后面的机器。通常在终端中,我们连接到该服务器的过程是通过另一个 ssh 会话中的 ssh 连接进行的,该会话连接到该服务器的“门户”。在终端中,它如下所示:

ssh -p portNumber [email protected]/
ssh serverBehindFirewall

但是如何使用 Ubuntu 的“连接到服务器”功能执行相同操作?我可以轻松地连接到门户服务器,如下所示:

ssh://[email protected]:portNumber/

但是我该如何添加额外的 ssh 连接呢?是否可以这样做:

ssh://[email protected]:portNumber/ssh://serverBehindFirewall

期待您的答复!

答案1

您可以在控制台上使用 ssh 端口转发,这样您就可以直接从计算机连接到防火墙后面的服务器。

# This will open a tunnel from your local machine, port 22022 to port
# 22 on serverBehindFirewall. You'll need to leave this window open.
localmachine:~$ ssh -L22022:serverBehindFirewall:22 [email protected]

# now you can open a second terminal on your local machine and
# connect directly to serverBehindFirewall on localhost:22022
localmachine:~$ ssh -p 22022 userbehindFirewall@localhost

完成第一步后,您还可以使用 的“连接到服务器”功能ssh://userbehindFirewall@localhost:22022/。如果您希望将其作为永久解决方案,则可以使用 autossh (主页指导

相关内容