Last active
November 12, 2020 16:39
-
-
Save dargmuesli/645a4d51ab1806ebfb3329fb05637318 to your computer and use it in GitHub Desktop.
Initial setup script for Hetzner servers.
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
# Run | |
# wget https://gist.githubusercontent.com/dargmuesli/645a4d51ab1806ebfb3329fb05637318/raw -O hetzner-start.sh && chmod +x hetzner-start.sh && ./hetzner-start.sh | |
sudo apt-get update \ | |
&& sudo apt-get -y dist-upgrade \ | |
&& sudo apt-get -y install git vim | |
passwd | |
echo "username: " | |
read username | |
useradd -U -G users,sudo -m -s /bin/bash "$username" | |
passwd "$username" | |
cp ~/.ssh/ /home/"$username"/.ssh -r | |
chown "$username":"$username" /home/"$username"/.ssh -R | |
sed -i "s/PermitRootLogin yes/PermitRootLogin no/g" /etc/ssh/sshd_config | |
sed -i "s/\#PasswordAuthentication yes/PasswordAuthentication no/g" /etc/ssh/sshd_config | |
/etc/init.d/ssh reload | |
vim /etc/hostname | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment