Skip to content

Instantly share code, notes, and snippets.

@simbalinux
Last active September 23, 2018 16:50
Show Gist options
  • Save simbalinux/a64e13d46deb69887f478f018cd2262c to your computer and use it in GitHub Desktop.
Save simbalinux/a64e13d46deb69887f478f018cd2262c to your computer and use it in GitHub Desktop.
Verify ssh keys exist || create new ones without password
#!/usr/bin/env bash
# check if ssh keys exist else create keys with no password automatically no prompting, ideal for shell scripts and automation
if [ -f $HOME/.ssh/id_rsa ]; then
echo rsa key installed
else
ssh-keygen -f /root/.ssh/id_rsa -t rsa -N ''
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment