Automating “enter” keypresses for bash script generating ssh keys

后端 未结 5 743
说谎
说谎 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 08:57

    It is recommended to use ed25519 for security and performance.

    yes "y" | ssh-keygen -o -a 100 -t ed25519 -C "Bla Bla" -f /mypath/bla -N ""
    

    here

    -o OpenSSH key format instead of older PEM (needs OpenSSH 6.5+)

    -a Number of primality test while screening DH-GEX candidates

    -t Type of key (ed25519, RSA, DSA etc.)

    -f /mypath/bla The output file path and name

    -N "" Use empty passphase

    and yes "y" for no interaction.

    It will generate two files

    /mypath/bla
    /mypath/bla.pub
    

    where the bla file is private and bla.pub is public.

提交回复
热议问题