mirror of
https://github.com/unifi-utilities/unifios-utilities.git
synced 2024-08-30 18:32:21 +00:00
Persistent SSH Key Example (#92)
This commit is contained in:
parent
f2810f184a
commit
be71225ef7
@ -49,6 +49,7 @@
|
||||
Examples:
|
||||
* Start a DNS Container [10-dns.sh](../dns-common/on_boot.d/10-dns.sh)
|
||||
* Start wpa_supplicant [on_boot.d/10-wpa_supplicant.sh](examples/udm-files/on_boot.d/10-wpa_supplicant.sh)
|
||||
* Add a persistent ssh key for the root user [on_boot.d/15-add-root-ssh-key.sh](examples/udm-files/on_boot.d/15-add-root-ssh-key.sh)
|
||||
|
||||
## Version History
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
#!/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
|
||||
|
Loading…
Reference in New Issue
Block a user