PermitRootLogin yes #默认开启,允许root认证登录
StrictHostKeyChecking no #默认开启,关闭后,对于未连接过的主机,不用输入yes进行确认
GSSAPIAuthentication no #默认开启,登陆的时候客户端需要对服务器端的IP地址进行反解析,如果服务器的IP地址没有配置PTR记录,那么就容易在这里卡住了
UseDNS no #默认开启,建议内网默认关闭
sshpass -p "$password" ssh -p $port -o StrictHostKeyChecking=no -o ConnectTimeout=$timeout $username@$host "command"
###sshpass命令
秘钥认证登录
RSAAuthentication yes #开启秘钥认证登录,默认状态为开启
密码认证登录
PasswordAuthentication yes #默认开启,允许密码认证登录
原文:https://www.cnblogs.com/alusss/p/12720600.html