Search code examples
bashsshssh-keys

Add SSH key from variable


I have a bash script inside a Docker container that needs to access remote server via ssh. I have SSH key inside a variable. How can I add it to SSH?


Solution

  • ssh-add - <<< "${SSH_PRIVATE_KEY}"