Skip to content

Instantly share code, notes, and snippets.

@wmcmurray
Last active November 8, 2021 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmcmurray/91aaffd9cf9f10f8a8dad7bd2fa89c70 to your computer and use it in GitHub Desktop.
Save wmcmurray/91aaffd9cf9f10f8a8dad7bd2fa89c70 to your computer and use it in GitHub Desktop.
Basic linode web server security configuration.
# A default linode web server does not have a lot of configuration done,
# those are important basic steps to perform in order to secure the server
# and also configure it properly !
# update dependencies
apt update
apt upgrade
# define hostname and timezone
hostnamectl set-hostname example-hostname
timedatectl set-timezone 'America/Montreal'
# disable ssh password login
(make sure the ssh keys I want to use are in /root/.ssh/authorized_keys !!)
nano /etc/ssh/sshd_config
(and set "PasswordAuthentication no")
systemctl restart sshd
# setup firewall
ufw allow ssh
ufw limit ssh
ufw allow 443
ufw allow 80
ufw show added
ufw enable
ufw status
# create a user for the project
adduser the-user-name-i-want
su - the-user-name-i-want
ssh-keygen -t rsa -b 4096
----- bonus
# fix mysqld high memory usage
nano /etc/mysql/my.cnf
[mysqld]
performance_schema='0'
service mysql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment