【问题标题】:Automatically no-overwrite in ssh-keygen在 ssh-keygen 中自动不覆盖
【发布时间】:2020-06-02 00:53:52
【问题描述】:

如果我跑步

ssh-keygen -t rsa -N "" -f id_rsa

而文件id_rsa已经存在,会提示我是否要覆盖:

id_rsa already exists.
Overwrite (y/n)?

如何在 bash 脚本中自动回答“否”?我检查了man ssh-keygen,但找不到任何此类选项。

【问题讨论】:

    标签: bash ssh-keygen


    【解决方案1】:

    你可以这样做: echo "n"|ssh-keygen -t rsa -N "" -f id_rsa

    【讨论】:

      【解决方案2】:

      您可以使用here-string 自动回答nOverwrite (y/n)? 问题。

      ssh-keygen -t rsa -N "" -f id_rsa <<< n
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-10-10
        • 1970-01-01
        • 2023-02-14
        • 2020-04-18
        • 1970-01-01
        • 2020-08-06
        • 1970-01-01
        • 2012-06-01
        相关资源
        最近更新 更多