How to prevent vagrant from requesting ssh passphrase

Everything works fine, but during the initialization process it keeps asking for the ssh passphrase, which is very annoying when you have 6 vm, it will tell you how 12 times (and the whole automation part seems to lose its point).

I tried searching the web, but couldn't find an answer to a fairly obvious question.

+3


source to share


1 answer


There are various ways to prevent this.

  • First and foremost and most obvious (but least preferred) is to remove the passphrase from the key:

    ssh-keygen -p -P old_passphrase -N "" -f /path/to/key_file
    
          

  • Another possibility is to use ssh-agent

    which will save an encrypted version of your key and perform the required operation when requested. You can find many tutorials and questions about this, but for completeness

    eval $(ssh-agent)
    ssh-add /path/to/key_file
    do-your-vagrant-stuff
    
          

  • You can use sshpass

    which will provide the passphrase to the commands ssh

    . It can read a passphrase as an argument, from an environment variable, or from a file (may not be safe)

    sshpass -p password your-vagrant-stuff
    
          



there are possibly other ways, but you should most likely use ssh-agent

.

0


source







All Articles