#!/bin/sh SSH_DIR="$HOME/.ssh" KEYS_DIR="$SSH_DIR/authorized_keys.d" KEYS_FILE="$SSH_DIR/authorized_keys" if [ ! -d "$KEYS_DIR" ]; then echo "creating $KEYS_DIR/" mkdir "$KEYS_DIR" fi if [ -e "$KEYS_FILE" ]; then mv "$KEYS_FILE" "$KEYS_FILE.bak" fi for file in "$KEYS_DIR/"*.pub; do cat "$file" >> "$KEYS_FILE" done