linuxserver/openssh-server 正在设置远程 ssh

linuxserver/openssh-server setting up remote ssh

我正在尝试在 linuxserver/openssh-server docker 图像上配置远程端口,以用作跳转容器到 NAT 后面的目标主机。我已在目标主机上尝试 运行 此命令 ssh -R 19999:localhost:2222 -p 2222 <container_user>@<container_host>,但出现以下错误:Warning: remote port forwarding failed for listen port 19999。我已经检查过端口 19999 是否已被使用,但没有。

我遇到了同样的问题,因此我通过 Google 搜索找到了您的问题。经过一些额外的搜索,我发现 linuxserver.io 已经创建了一个修改过程来启用隧道,如下所述: https://github.com/linuxserver/docker-mods/tree/openssh-server-ssh-tunnel

This mod adds ssh tunnelling to openssh-server, by enabling tcp forwarding during container start.

In openssh-server docker arguments, set an environment variable DOCKER_MODS=linuxserver/mods:openssh-server-ssh-tunnel

我可以验证它在我的机器上是否按预期工作:

$ ssh -p 2222 -R 0.0.0.0:7777:localhost:5000 agent@localhost                                                                                              
The authenticity of host '[localhost]:2222 ([::1]:2222)' can't be established.
ECDSA key fingerprint is SHA256:sKueSIX9m+qCrCNk0cCYjVC4uKcYltcO+msZKqgj5nQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[localhost]:2222' (ECDSA) to the list of known hosts.
Welcome to OpenSSH Server