我尝试从我的 mac cli 自动 ssh 进入另一台机器。使用 sshssh <user>@<ip-adress>
我可以登录到那台机器。但是当我使用它时autossh <user>@<ip-adress>
它只会打印。
usage: autossh [-V] [-M monitor_port[:echo_port]] [-f] [SSH_OPTIONS]
-M specifies monitor port. May be overridden by environment
variable AUTOSSH_PORT. 0 turns monitoring loop off.
Alternatively, a port for an echo service on the remote
machine may be specified. (Normally port 7.)
-f run in background (autossh handles this, and does not
pass it to ssh.)
-V print autossh version and exit.
Environment variables are:
AUTOSSH_GATETIME - how long must an ssh session be established
before we decide it really was established
(in seconds). Default is 30 seconds; use of -f
flag sets this to 0.
AUTOSSH_LOGFILE - file to log to (default is to use the syslog
facility)
AUTOSSH_LOGLEVEL - level of log verbosity
AUTOSSH_MAXLIFETIME - set the maximum time to live (seconds)
AUTOSSH_MAXSTART - max times to restart (default is no limit)
AUTOSSH_MESSAGE - message to append to echo string (max 64 bytes)
AUTOSSH_PATH - path to ssh if not default
AUTOSSH_PIDFILE - write pid to this file
AUTOSSH_POLL - how often to check the connection (seconds)
AUTOSSH_FIRST_POLL - time before first connection check (seconds)
AUTOSSH_PORT - port to use for monitor connection
AUTOSSH_DEBUG - turn logging to maximum verbosity and log to
stderr
当我在另一台机器上安装 autossh 时,我可以将 autossh 连接到我的 Mac。
mac 安装有问题吗?我是通过 brew 安装的。
感谢您的帮助。
答案1
该解决方案将解决该问题。 https://serverfault.com/questions/342441/autossh-l-fails-with-same-command-as-ssh-how-to-make-it-work
您必须使用监视选项autossh -M 0 <user>@<ip-adress>
。