Created
September 20, 2020 17:43
-
-
Save jeffmccune/dccae821ef1309d2976598cd99f5724a to your computer and use it in GitHub Desktop.
Setup Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# Initial setup of a server. Run this as root. | |
apt -qq -y install curl git sudo rsync | |
set -eu | |
install -o0 -g0 -m0700 -d /root/.ssh | |
tmpfile="$(mktemp)" | |
curl --location --silent --output "$tmpfile" https://github.com/jeffmccune.keys | |
install -o0 -g0 -m0644 "$tmpfile" /root/.ssh/authorized_keys | |
if [[ -d ~localadm ]]; then | |
install -olocaladm -glocaladm -m0700 -d ~localadm/.ssh | |
install -olocaladm -glocaladm -m0644 "$tmpfile" ~localadm/.ssh/authorized_keys | |
fi | |
rm -f "$tmpfile" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment