Automating “enter” keypresses for bash script generating ssh keys

后端 未结 5 704
说谎
说谎 2020-12-04 08:36

I would like to create script, which simply runs ssh-keygen -t rsa. But how to pass to it 3 times enter?

5条回答
  •  無奈伤痛
    2020-12-04 09:05

    Agree with Michel Marro except that it needs some more: If the file already exists, it will still be interactive asking if it has to overwrite it.

    Use the answer of this question.

    yes y | ssh-keygen -q -t rsa -N '' >/dev/null
    

    The redirection to null is necessary to silence the overwrite message.

提交回复
热议问题