1# Bash helper functions for adding SSH keys 2 3function add_ssh_keys() { 4 local key_string="${1}" 5 mkdir -p ~/.ssh 6 chmod 700 ~/.ssh 7 echo -n "${key_string}" >~/.ssh/id_rsa_base64 8 base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 >~/.ssh/id_rsa 9 chmod 600 ~/.ssh/id_rsa 10} 11 12function add_doc_server_ssh_keys() { 13 local key_string="${1}" 14 local server_url="${2}" 15 local server_user="${3}" 16 add_ssh_keys "${key_string}" 17 echo -e "Host ${server_url}\n\tStrictHostKeyChecking no\n\tUser ${server_user}\n" >>~/.ssh/config 18} 19