autossh用法整理
首先,我们从autossh的manpage来看下:
NAME
autossh — monitor and restart ssh sessions
SYNOPSIS
autossh [-V] [-M port[:echo_port]] [-f] [SSH_OPTIONS]
DESCRIPTION
autossh is a program to start a copy of ssh and monitor it, restarting it as necessary should it die or stop passing traffic.
从这几句简单清楚的描述,我们知道autossh本身就是个管理、维护ssh的命令,所以其参数也只有最基本的-V(version)、-M(monitoring)、-f(background)。而我们常说的端口转发,反向代理等厉害的功能其实是ssh实现的,我们把参数传给autossh,然后autossh传给ssh来实现特定的功能。
接着,我们看下ssh的manpage:
NAME
ssh — OpenSSH SSH client (remote login program)
SYNOPSIS
ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file] [-L address]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]
[-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]] [user@]hostname [command]
DESCRIPTION
ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote
machine. It is intended to provide secure encrypted communications between two untrusted hosts over an
insecure network. X11 connections, arbitrary TCP ports and UNIX-domain sockets can al