Add SSH keys, change hostname, and restart

This commit is contained in:
Kris Lamoureux 2020-01-23 20:27:23 -05:00
parent b5428c8430
commit d68cc353fa
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
2 changed files with 23 additions and 3 deletions

3
authorized_keys Normal file
View File

@ -0,0 +1,3 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC0Eb7YkrCxFkmdXNQWevACXglrFpiWofFVmuLvQOh7KA88/R+UxxSw23HkqjLQJow4UAIT9gqIO4XesPeePXeaZ7wcu9PxiwQoBCmMl7FMs6gCRj7sYjf2e0AqkfjOB52agRe2KApojgy8LtiIT8kvgWBg2VAmX54npr7crkE4NlQoYeh7jgGbrV2btDOs7L/rw2Z4yPVjfG/QgzRPk2IQk3riNXoLfP0wV7nI3sejK46GmgAE+NxeAIbaZF6d6DSXm9B4Ez6t5JNOKaq91mjZRqci6yZkkwqQYYpYCHafWT4AI77fcGWIYDk8QUnATwoLvDCe26+cgMzQJx1k+oRCAjqpenoMBMiag+O6tyuP7h7PH1wNpzsxOgHJHZlqzXrnZnB5xhz25SGXECnXECakdY7iUug4QgghFiDjYhD6apJBxKPkjToUcwoLedpr3Y3e8yPBjcAUBLaXa+HJaKDegBxgRd907thgWv8KrBt+2CtG/DH6rlZwxH5hJFHTeg2MARHo7QOocsV8BxRTT/3Ij5NLlFR8Fovv9CkizHdJ5o+En9/EN8ppKkPdqaPJQMcxaTcuQV6Ggg8p7F7zh1a78kWXeMOZtYHCWR1qJyCIVWi9s+fEuKcjf2HHIaazbVunZQ+mBIJbmAIbqq6zXbHQ2NLWsAIMnIQs3fd8YlKDeQ== kris@freedom-pc
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+Cp72PZkmjBSmSGacEWGvUpm5cv/A5mIw5wu7mrENWMlslGXnrx3PwS5daUmS/nfrTyX79wVkBIV1JXJxPAZmCooANLklba4A/+ykyJX6Q+6ENVXtUm5IbKX+pGQiN5EB+87sxpZimfdT+x6a12/xuhLMQD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RTYUvc81YijAtPYWApMNqU9z03mTdBQoSkr9DykjQiGe8vhUdwCXYQ+hX0ZxHiiQZ9FPO1qK6fk4PVdPx5ejJUr3hAM3Qe7H/pQA1RKXJ+EGVFicSQGPeS4ufhUACWFUaThHkO3CjCAC2vCcx6BlNuUfpHr7slO7xaYKmw== kris@freeitathens.org

View File

@ -1,12 +1,19 @@
#!/bin/bash
if [ $EUID -ne 0 ]; then
echo "You must run this script as root"
exit 1
fi
DATE=$(date '+%Y%m%d')
TMP_DIR=$(mktemp -d)
SOURCE_FILE="/etc/apt/sources.list"
GIT_LOC="https://github.com/krislamo/bootstrap.git"
mv $SOURCE_FILE $SOURCE_FILE.$DATE
sed '/deb cdrom/d' $SOURCE_FILE.$DATE > $SOURCE_FILE
echo "Enter name server's new hostname:"
read NEW_HOSTNAME
cp /etc/apt/sources.list /etc/apt/sources.list.$DATE
sed -i '/deb cdrom/d' /etc/apt/sources.list
apt-get update -y
apt-get upgrade -y
@ -15,3 +22,13 @@ apt-get install git -y
cd $TMP_DIR
git clone $GIT_LOC
cd bootstrap
mkdir -p /root/.ssh/
cp --update authorized_keys /root/.ssh/authorized_keys
apt-get install openssh-server -y
hostnamectl set-hostname $NEW_HOSTNAME
cp /etc/hosts /etc/hosts.$DATE
sed -i "s/test/$NEW_HOSTNAME/g" /etc/hosts
read -p "Press [enter] to restart this machine"
/sbin/shutdown -r now