ssh: The authenticity of host 'hostname' can't be established

前端 未结 16 1179
时光取名叫无心
时光取名叫无心 2020-12-04 05:04

When i ssh to a machine, sometime i get this error warning and it prompts to say \"yes\" or \"no\". This cause some trouble when running from scripts that automatically ssh

16条回答
  •  广开言路
    2020-12-04 05:47

    The best way to go about this is to use 'BatchMode' in addition to 'StrictHostKeyChecking'. This way, your script will accept a new hostname and write it to the known_hosts file, but won't require yes/no intervention.

    ssh -o BatchMode=yes -o StrictHostKeyChecking=no user@server.example.com "uptime"
    

提交回复
热议问题