Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
命令在命令行中运行时Systemd SSH隧道服务失败_Ssh_Systemd_Ssh Tunnel - Fatal编程技术网

命令在命令行中运行时Systemd SSH隧道服务失败

命令在命令行中运行时Systemd SSH隧道服务失败,ssh,systemd,ssh-tunnel,Ssh,Systemd,Ssh Tunnel,我一直在尝试设置一个SSH反向隧道Systemd服务,用于自动将我的非公共IP计算机暴露到internet上进行SSHing。我有两个不同的服务,一个指向我自己的服务器(另一台具有公共IP的计算机),工作正常,另一个尝试使用(通过ssh客户端的TCP隧道的免费服务)。我的服务在我自己的服务器上运行良好,但在Serveo上失败 我的服务定义如下: [Unit] Description=Setup a remote tunnel to serveo.net Wants=network-online.

我一直在尝试设置一个SSH反向隧道Systemd服务,用于自动将我的非公共IP计算机暴露到internet上进行SSHing。我有两个不同的服务,一个指向我自己的服务器(另一台具有公共IP的计算机),工作正常,另一个尝试使用(通过ssh客户端的TCP隧道的免费服务)。我的服务在我自己的服务器上运行良好,但在Serveo上失败

我的服务定义如下:

[Unit]
Description=Setup a remote tunnel to serveo.net
Wants=network-online.target
After=network-online.target
StartLimitIntervalSec=0

[Service]
User=ssh-tunnel
Group=ssh-tunnel
ExecStart=/usr/bin/ssh -T -o ServerAliveInterval=60 -i /var/lib/ssh-tunnel/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ExitOnForwardFailure=yes -R myalias:58227:localhost:22 serveo.net
Restart=always
RestartSec=60

[Install]
WantedBy=multi-user.target
在终端中执行相同命令时,其工作正常:

sudo -u ssh-tunnel -g ssh-tunnel /usr/bin/ssh -T -o ServerAliveInterval=60 -i /var/lib/ssh-tunnel/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ExitOnForwardFailure=yes -R myalias:58227:localhost:22 serveo.net
我能看到的我自己的服务器和Serveo之间行为的唯一区别是Serveo有一种交互式命令界面


有人对Systemd services有类似的问题吗?

Serveo需要一个交互式shell。您想添加吗

[服务] 标准输入=tty力

强制使用与serveo配置一起工作的shell