How to do ssh with a timeout in a script?

后端 未结 6 1362
野趣味
野趣味 2020-12-12 11:17

I\'m executing a script connecting via password-less SSH on a remote host. I want to set a timeout, so that if the remote host is taking an infinite time to run, I want to c

6条回答
  •  伪装坚强ぢ
    2020-12-12 11:39

    You could also connect with flag

    -o ServerAliveInterval=
    so the SSH client will send a null packet to the server each seconds, just to keep the connection alive. In Linux this could be also set globally in /etc/ssh/ssh_config or per-user in ~/.ssh/config.

提交回复
热议问题