当来自 cron 的 运行 时,远程端口转发断开连接
Remote port forwarding disconnected when run from cron
我已经安装了 FreeBSD 并且需要 运行 定期反转 shell 以建立并保持与客户端的 SSH 连接(没有 public IP)。当从终端 运行 运行 ssh -R
脚本时,它按预期工作,但是当我 运行 它作为 cron 命令时,连接建立并立即断开连接。
这是来自服务器的auth.log:
Jan 26 08:50:00 sshd[9696]: Accepted publickey for XXXX from XXX.XXX.XXX.XXX port XXXXX ssh2: RSA SHA256: xxxxxxxxx
Jan 26 08:50:00 sshd[9696]: pam_unix(sshd:session): session opened for user XXXX by (uid=0)
Jan 26 08:50:00 systemd: pam_unix(systemd-user:session): session opened for user XXXX by (uid=0)
Jan 26 08:50:01 systemd-logind[458]: New session 107 of user XXXX.
Jan 26 08:50:01 sshd[9794]: Received disconnect from XXX.XXX.XXX.XXX port XXXXX:11: disconnected by user
Jan 26 08:50:01 sshd[9794]: Disconnected from user XXXX XXX.XXX.XXX.XXX port XXXXX
Jan 26 08:50:01 sshd[9696]: pam_unix(sshd:session): session closed for user XXXX
Jan 26 08:50:01 systemd-logind[458]: Session 107 logged out. Waiting for processes to exit.
Jan 26 08:50:01 systemd-logind[458]: Removed session 107.
您是否知道导致此行为的原因以及解决方法?
已解决 - 请参阅上面的帖子。谢谢
我已经安装了 FreeBSD 并且需要 运行 定期反转 shell 以建立并保持与客户端的 SSH 连接(没有 public IP)。当从终端 运行 运行 ssh -R
脚本时,它按预期工作,但是当我 运行 它作为 cron 命令时,连接建立并立即断开连接。
这是来自服务器的auth.log:
Jan 26 08:50:00 sshd[9696]: Accepted publickey for XXXX from XXX.XXX.XXX.XXX port XXXXX ssh2: RSA SHA256: xxxxxxxxx
Jan 26 08:50:00 sshd[9696]: pam_unix(sshd:session): session opened for user XXXX by (uid=0)
Jan 26 08:50:00 systemd: pam_unix(systemd-user:session): session opened for user XXXX by (uid=0)
Jan 26 08:50:01 systemd-logind[458]: New session 107 of user XXXX.
Jan 26 08:50:01 sshd[9794]: Received disconnect from XXX.XXX.XXX.XXX port XXXXX:11: disconnected by user
Jan 26 08:50:01 sshd[9794]: Disconnected from user XXXX XXX.XXX.XXX.XXX port XXXXX
Jan 26 08:50:01 sshd[9696]: pam_unix(sshd:session): session closed for user XXXX
Jan 26 08:50:01 systemd-logind[458]: Session 107 logged out. Waiting for processes to exit.
Jan 26 08:50:01 systemd-logind[458]: Removed session 107.
您是否知道导致此行为的原因以及解决方法?
已解决 - 请参阅上面的帖子。谢谢