solana/net/scripts/add-testnet-solana-user-authorized_keys.sh
Trent Nelson 8362b408d9
Move testnet ssh key (#5770)
* Factor out hardcoded testnet ssh key path

* Build/create test net ssh key path

* Rename testnet ssh dir

* Give testnetSSHDir a more generic name

* shellcheck

* favor hardcoded paths over `paths.sh`

* Put instance-startup-complete stamp in the scratch dir as well

* Rename `/solana` > `/solana-scratch`
2019-09-03 18:51:16 -06:00

22 lines
554 B
Bash
Executable File

#!/usr/bin/env bash
set -ex
[[ $(uname) = Linux ]] || exit 1
[[ $USER = root ]] || exit 1
[[ -d /home/solana/.ssh ]] || exit 1
if [[ -z $SOLANA_PUBKEYS ]]; then
echo "Warning: source solana-user-authorized_keys.sh first"
fi
# solana-user-authorized_keys.sh defines the public keys for users that should
# automatically be granted access to ALL testnets
for key in "${SOLANA_PUBKEYS[@]}"; do
echo "$key" >> /solana-scratch/authorized_keys
done
sudo -u solana bash -c "
cat /solana-scratch/authorized_keys >> /home/solana/.ssh/authorized_keys
"