mynote/linux/ssh.md
2025-11-16 16:00:27 +08:00

544 B

auto ssh proxy

ssh -C -N -R remote_port:localhost:local_port username@remote_server

vim /etc/systemd/system/vautossh.service

[Unit]
Description=AutoSSH tunnel service for reverse port forwarding
After=network.target

[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/ssh  -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -C -N -R remote_port:localhost:local_port username@remote_server
Restart=always
User=your_username

[Install]
WantedBy=multi-user.target

systemctl daemon-reload systemctl enable vautossh.service