Skip to content

Instantly share code, notes, and snippets.

@brunneis
Last active December 9, 2019 21:09
Show Gist options
  • Save brunneis/00134198d4ac6510de50ce12db831432 to your computer and use it in GitHub Desktop.
Save brunneis/00134198d4ac6510de50ce12db831432 to your computer and use it in GitHub Desktop.
Post-setup on Proxmox servers
#!/bin/bash
# Remove annoying message
sed -i.bak "s/data.status !== 'Active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
systemctl restart pveproxy.service
# Remove enterprise repo
rm /etc/apt/sources.list.d/pve-enterprise.list
# Dependencies
apt-get -y update; apt-get -y install curl sudo htop git
# Add user
adduser brunneis
usermod -aG sudo brunneis
su - brunneis
# Create the .ssh directory if it does not exist
mkdir -m 700 -p ~/.ssh
# Import public key
curl https://dev.brunneis.com/brunneis-ecdsa.pub >> ~/.ssh/authorized_keys
# Fix permissions
chmod 600 ~/.ssh/authorized_keys
# Enable pubkey auth
sudo sed -ri 's/#?PubkeyAuthentication\sno/PubkeyAuthentication yes/' /etc/ssh/sshd_config
sudo sed -ri 's/#PubkeyAuthentication\syes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
# Disable password login
sudo sed -ri 's/#?PasswordAuthentication\syes/PasswordAuthentication no/' /etc/ssh/sshd_config
# Restart the SSH server
sudo systemctl restart sshd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment