0

I want to automate user creation along with the rsa key generation in a shell script. But while generating the rsa key we need to give inputs for these three things.

  • Enter file in which to save the key (/root/.ssh/id_rsa):
  • Enter passphrase (empty for no passphrase):
  • Enter same passphrase again:

I want to a custom path for the id_rsa file(the first one) and blank for the passphrase.

I tried to achieve this via send command, but it didn't work. Can anyone help me on this?

1 Answer 1

2

From man ssh-keygen:

SYNOPSIS
     ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
                [-N new_passphrase] [-C comment] [-f output_keyfile]

You'll want to do something like this:

ssh-keygen -t rsa -N "" -f /wherever/you/want/id_rsa

If you want to silence ssh-keygen's messages, add the -q option to the command line.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.