Skip to content

Instantly share code, notes, and snippets.

@hartek
hartek / secure_vps.sh
Last active May 19, 2019 16:50
Script that will perform basic configuration on a freshly-created Debian VPS
#!/bin/bash
# Move SSH access keys from root into debian
cp -a /root/.ssh /home/debian/.ssh
chown -R debian:debian /home/debian/.ssh
echo "" > /root/.ssh/authorized_keys
echo "[+] Reconfigured user permissions!"
# Disallow sudo usage for debian
mv /etc/sudoers.d/debian-cloud-init /etc/sudoers.d/debian-cloud-init~
@hartek
hartek / sshd_config
Last active May 17, 2019 22:56
Standard secure SSH configuration for a VPS
# Standard SSH configuration by hartek from Follow the White Rabbit (https://www.fwhibbit.es)
# Network configuration
Port 22 # Change this maybe
AddressFamily inet
ListenAddress 0.0.0.0
#ListenAddress ::
# Authentication
LoginGraceTime 10