Files
notes_estom/MyScript/network/autossh.service
2025-07-12 06:00:49 -04:00

21 lines
597 B
Desktop File

[Unit]
Description=Robust SSH Reverse Tunnel and Port Forward
After=network.target
[Service]
User=estom
# 使用绝对路径指定密钥(如果使用密钥认证)
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -M 0 -o "ExitOnForwardFailure=yes" -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -N -T -i /home/estom/.ssh/id_rsa -R 8000:localhost:22 root@8.141.4.34
# 关键修复参数
Restart=always
RestartSec=10
KillMode=process # 确保终止所有子进程
# 启动频率限制调整
StartLimitIntervalSec=60
StartLimitBurst=10
[Install]
WantedBy=multi-user.target