Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active April 2, 2023 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacr/d506fb69b86f6804028c233d3a981243 to your computer and use it in GitHub Desktop.
Save dacr/d506fb69b86f6804028c233d3a981243 to your computer and use it in GitHub Desktop.
ssh agent automatic provisioning using a ssh private key initialized through an environment variable. / published by https://github.com/dacr/code-examples-manager #3a860b1c-a0c5-4a10-9e1e-95f5edb7a643/85f00b1fa1594984431a1f31859e645ebb3c2c8d
## summary : ssh agent automatic provisioning using a ssh private key initialized through an environment variable.
## keywords : bash, ssh, ssh-agent, ssh-keys
## publish : gist
## authors : David Crosson
## license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
## id : 3a860b1c-a0c5-4a10-9e1e-95f5edb7a643
## created-on : 2019-07-02T19:44:51+02:00
## managed-by : https://github.com/dacr/code-examples-manager
eval $(ssh-agent -s)
echo "$WRITE_SSH_PRIVATE_KEY" | ssh-add -
# For next lines, remember you should know what you're doing ;)
mkdir -m 700 $HOME/.ssh
ssh-keyscan -H www.somehosts.fr >> ~/.ssh/known_hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment