cuddle-rust-service-plan/scripts/setup_ssh.sh

26 lines
580 B
Bash
Raw Normal View History

2022-08-14 21:44:28 +02:00
#!/bin/sh
set -e
if [ ! -d ~/.ssh ]; then
mkdir -p ~/.ssh
chmod 700 ~/.ssh
fi
if [ -n "$SSH_KEY" ]; then
SSH_KEY_ID="$HOME/.ssh/id_ed25519"
echo $SSH_KEY > $SSH_KEY_ID
chmod 600 $SSH_KEY_ID
# Append the required to the ssh config file.
# Switch out the hostname for different hosts.
# The line count is 5
echo "\nHost ci.i.kjuulh.io\n"\
" IdentityFile ${SSH_KEY_ID}\n"\
" IdentitiesOnly yes\n"\
" UserKnownHostsFile=/dev/null\n"\
" StrictHostKeyChecking no"\
>> $HOME/.ssh/config
fi