unifios-utilities/on-boot-script/examples/udm-files/on_boot.d/15-add-root-ssh-key.sh
2021-01-04 21:10:40 -08:00

11 lines
240 B
Bash

#!/bin/sh
MY_SSH_KEY="ADD PUBLIC SSH KEY HERE"
KEYS_FILE="/root/.ssh/authorized_keys"
# Places public key in ~/.ssh/authorized_keys if not present
if ! grep -Fxq "$MY_SSH_KEY" "$KEYS_FILE"; then
echo "$MY_SSH_KEY" >> "$KEYS_FILE"
fi