forked from espressif/arduino-esp32
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.sh
19 lines (17 loc) · 561 Bytes
/
utils.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
# Bash helper functions for adding SSH keys
functionadd_ssh_keys {
local key_string="${1}"
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo -n "${key_string}">~/.ssh/id_rsa_base64
base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 >~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
}
functionadd_doc_server_ssh_keys {
local key_string="${1}"
local server_url="${2}"
local server_user="${3}"
add_ssh_keys "${key_string}"
echo -e "Host ${server_url}\n\tStrictHostKeyChecking no\n\tUser ${server_user}\n">>~/.ssh/config
}