ssh优化

一、ssh开启root远程登录


PermitRootLogin yes         #默认开启,允许root认证登录

二、ssh登录速度优化


StrictHostKeyChecking no #默认开启,关闭后,对于未连接过的主机,不用输入yes进行确认
GSSAPIAuthentication no #默认开启,登陆的时候客户端需要对服务器端的IP地址进行反解析,如果服务器的IP地址没有配置PTR记录,那么就容易在这里卡住了
UseDNS no #默认开启,建议内网默认关闭

三、ssh远程主机执行命令


sshpass -p "$password" ssh -p $port -o StrictHostKeyChecking=no -o ConnectTimeout=$timeout $username@$host "command"
###sshpass命令

四、登录方式配置


秘钥认证登录
RSAAuthentication yes       #开启秘钥认证登录,默认状态为开启
密码认证登录
PasswordAuthentication yes  #默认开启,允许密码认证登录

猜你喜欢

转载自www.cnblogs.com/alusss/p/12720600.html
ssh