Linux command
autossh 命令
网络
需要网络或远程资源。
常用示例
Create
autossh -M [20000] -N -L [8080:localhost:80] [user@remote]
Example
autossh -M 0 -N -L [8080:localhost:80] [user@remote]
Reverse
autossh -M [20000] -N -R [8080:localhost:80] [user@remote]
Example
autossh -f -M [20000] -N -L [8080:localhost:80] [user@remote]
说明
autossh wraps SSH connections with automatic reconnection. It monitors the connection and restarts it if it dies, making SSH tunnels and connections persistent. The tool is essential for maintaining long-running SSH tunnels, remote port forwards, and SOCKS proxies.
参数
- -M _port_:_port_
- Monitoring port(s). Use -M 0 to disable port monitoring
- -f
- Background after authentication
- -N
- No command execution (forwarding only)
- -L _port_:_host_:_port_
- Local port forward
- -R _port_:_host_:_port_
- Remote port forward
- -D _port_
- SOCKS proxy
FAQ
What is the autossh command used for?
autossh wraps SSH connections with automatic reconnection. It monitors the connection and restarts it if it dies, making SSH tunnels and connections persistent. The tool is essential for maintaining long-running SSH tunnels, remote port forwards, and SOCKS proxies.
How do I run a basic autossh example?
Run `autossh -M [20000] -N -L [8080:localhost:80] [user@remote]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -M _port_:_port_ do in autossh?
Monitoring port(s). Use -M 0 to disable port monitoring