A new server on the internet is found and probed within minutes. Do these steps as soon as you first connect, before you install anything else. On a Self-Managed VPS, security is your responsibility; CamCore can quote to do it for you.
The commands below are for Ubuntu and Debian. Other operating systems use different commands for the same steps.
1. Install updates
apt update && apt full-upgrade -y, then reboot if a new kernel was installed.
2. Turn on automatic security updates
apt install -y unattended-upgrades, then dpkg-reconfigure -plow unattended-upgrades and choose Yes.
3. Create your own user
Make an everyday user and give it admin rights, so you don't sign in as root: adduser yourname, then usermod -aG sudo yourname.
4. Sign in with a key instead of a password
- On your own computer, run
ssh-keygen -t ed25519and accept the defaults. - Copy the key to the server:
ssh-copy-id yourname@followed by the server's IP address. On Windows, paste the contents of your.pubfile into~/.ssh/authorized_keyson the server instead. - Open a new window and check you can sign in as your new user without a password. Keep the first window open until this works.
5. Turn off password and root sign-in
Edit /etc/ssh/sshd_config and set PasswordAuthentication no and PermitRootLogin no. Then run systemctl reload ssh and test again from a new window before closing the old one.
6. Turn on the firewall
ufw allow OpenSSH, then allow only what you need, such as ufw allow 80,443/tcp for a website, then ufw enable.
7. Set up backups
Copy your data somewhere off the server regularly, or ask CamCore to quote for backups. A rebuild or a failure without a backup loses everything.
If you lock yourself out
CamCore can give you console access to recover the server. Submit a request on help.camcore.au. Under Which CamCore service is this about? choose Domains, hosting and email, and put the server's IP address in Reference. Recovery work inside the server is quoted before it starts.
Comments
0 comments
Please sign in to leave a comment.