Generate SSH Keys Non-Interactively
Written on March 8th, 2022 by Cody SniderBackground
Sometimes you need a key without those pesky prompts.
Generate Key
#!/bin/bash
# Create SSH directory
mkdir -p ~/.ssh/
# Generate key
# -b 4096 (4096 bits, we're making this a bit stronger than the default)
# -t rsa (RSA key type)
# -f ~/.ssh/my_new_key (the output file)
# -q (silent, no console output)
# -N "" (no passphrase, but feel free to add one between the quotes)
ssh-keygen -b 4096 -t rsa -f ~/.ssh/my_new_key -q -N ""