ssh -o ConnectTimeout=3 -o ConnectionAttempts=5 -o PasswordAuthentication=no -o StrictHostKeyChecking=no $ip “command”
安全
1 ConnectTimeout=3 链接时超时时间,3秒
2 ConnectionAttempts=5 链接失败后重试次数,5次
3 PasswordAuthentication=no 是否使用密码认证,(在遇到没作信任关系时很是有用,否则会卡在那里)
4 StrictHostKeyChecking=no 第一次登录服务器时自动拉取key文件,(跟上面同样,而且在第一次ssh登录时,自动应答yes)
5 ServerAliveInterval=60 设置保持链接时间,即为了保持会话,每隔60s向服务端发一次信号。bash