shell - 如何设置ssh超时时间?

标签 shell ssh timeout

我正在远程主机上执行通过无密码 SSH 连接的脚本。我想设置一个超时,这样如果远程主机运行的时间无限长,我想退出该 ssh session 并继续 sh 脚本中的其他行。

如何设置超时?

最佳答案

ssh -o ConnectTimeout=10  <hostName>

其中 10 是以秒为单位的时间。此超时仅适用于连接的创建。

关于shell - 如何设置ssh超时时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4936807/

相关文章:

javascript - 绕过 CloudFlare 的 100 秒超时

c - 输出仍然保留在缓冲区中并在每个子进程之后打印出来

c - 执行 ("/bin/sh", 0, 0);在管道中

Git 远程 : Error: fatal: protocol error: bad line length character: Unab

linux - 使用 nohup 在与 ssh 断开连接时帮助运行 python 代码循环

xcode - iOS 应用程序 - 设置 UIWebView 加载超时

最后添加一个新列的 shell 脚本

java - 使用脚本运行 java jar 文件

linux - SSH 隧道无法重新打开。没有权限

entity-framework - Azure SQL 数据库操作超时