authorized_keys provisioning file
This commit is contained in:
parent
4751c8d73e
commit
253b1156bb
19
just-authorized-keys/prov.sh
Normal file
19
just-authorized-keys/prov.sh
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
URL="https://dl.sneak.cloud/0000/authorized_keys"
|
||||
|
||||
function install_authorized_keys() {
|
||||
mkdir -p /root/.ssh
|
||||
curl -sL $URL > /root/.ssh/authorized_keys.new
|
||||
if [[ $(wc -l /root/.ssh/authorized_keys.new | awk '{print $1}') -gt 0 ]]; then
|
||||
mv /root/.ssh/authorized_keys.new /root/.ssh/authorized_keys
|
||||
else
|
||||
rm -f /root/.ssh/authorized_keys.new
|
||||
echo "failed to download authorized_keys" > /dev/stderr
|
||||
return
|
||||
fi
|
||||
chmod 700 /root/.ssh
|
||||
chmod 600 /root/.ssh/authorized_keys
|
||||
}
|
||||
|
||||
install_authorized_keys
|
Loading…
Reference in New Issue
Block a user