#!/bin/bash script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd "$script_dir" || exit 1 mkdir -p ~/.ssh touch ~/.ssh/authorized_keys for pubkey in *.pub; do if [[ -f "$pubkey" ]]; then cat "$pubkey" >> ~/.ssh/authorized_keys echo "Added $pubkey to authorized_keys" fi done chmod 600 ~/.ssh/authorized_keys # removes duplicates #sort -u ~/.ssh/authorized_keys -o ~/.ssh/authorized_keys