I am back with another published article.

Ideogram.ai: penguin in a server room covered in ice and snow, whole picture made out of green matrix style lines of code, cinematic

Please be kind! I am a self-taught Linux user and by no means an expert. My goal with this guide is to help newcomers to Linux have an easier and more secure start.

To all the experts out there, please be kind and do share your tips and observations. I am happy to keep updating the article to make the self-hosting world more secure.

https://nerdyarticles.com/debian-server-essentials-setup-configure-and-hardening-your-system/

2 points

Great guide. Agree with disable IPv6, extra unnecessary exposure and firewall effort. Consider Automatic updates, review ports/disable unwanted services.

permalink
report
reply
1 point

Automated security updates (unattended updates), netstat -ap --numeric-ports (for process review)

Also consider that debian is the downstream distribution of ubuntu, its usually older but more stable. More stable => less bugs => more secure

permalink
report
parent
reply
2 points

Mozilla has some guidelines for SSH which I use: https://infosec.mozilla.org/guidelines/openssh

Only thing I do differently is I use ed25519 instead of RSA.

ssh-keygen -t ed25519 -a 100
permalink
report
reply
1 point

Thanks!

I saw the ed25519 keys sometime ago, but haven’t had time to understand it.

Will look into it and the link!

permalink
report
parent
reply
1 point

Same protections as RSA but more efficient cause same strength of security but with shorter length making it fast.

There is Edsa too but since it was developed by NSA, people are skeptic it may have a back door…

permalink
report
parent
reply
1 point

Nice work!

Some small pieces of feedback:

  • You can disable the root user during installation, by leaving the root password blank. The installer explains this in the text at the top of the page. If you do this, root will be disabled and sudo will be installed automatically
  • If you really want to control which users can SSH in, it’s recommended to create a group and use AllowGroups, rather than allowing individual users via AllowUsers. Note that once you disable PasswordAuthentication, the only users that can SSH in are users that have keys in authorized_keys, so you don’t really need to use AllowUsers or AllowGroups.
  • Disabling IPv6 is unnecessary. If you don’t want to use it, then just… don’t use it? You should ideally always have IPv6 enabled for connections to the internet though. It’s generally faster due to better routing (see Google’s latency impact data: https://www.google.com/intl/en/ipv6/statistics.html#tab=per-country-ipv6-adoption), and more future-proof.
  • You may want to consider CrowdSec instead of fail2ban. It’s more efficient and they have a shared list of known bad IPs that you can use.
permalink
report
reply
1 point

You may want to consider CrowdSec instead of fail2ban. It’s more efficient and they have a shared list of known bad IPs that you can use.

interesting, I’ll have to check out Crowdsec

permalink
report
parent
reply
1 point

Hi Daniel15. Is it recommended to disable the root user for a server during installation as you suggested? Are there never any tasks which must (or should) be executed as root for server setup or maintenance? I just built my first (Debian) server, so quite new to it all. Thanks.

permalink
report
parent
reply
1 point

You can do almost everything with sudo. Some thing are easier when done as the root user (such as setting cron jobs that need root permissions), but it should never be a necessity.

If you really do need root user, you can still enable root temporarily and disable it again.

permalink
report
parent
reply
1 point

Anything that you absolutely must do as root can be done using sudo -i which will give you a root shell.

permalink
report
parent
reply
1 point

This is fire, love it!

permalink
report
reply
1 point

Another great article! I’m curious about the reasoning for using Debian on a Pi vs the Pi OS which is based off Debian?

permalink
report
reply
1 point

For Raspberry Pi’s I prefer DietPi which is Debian based but not full of unnecessary stuff for servers like Pi OS is.

permalink
report
parent
reply
1 point

DietPi

+1 for DietPi. It’s only system I have installed on my Raspberries and also on my Odroid H3.

permalink
report
parent
reply
1 point

I only use Alpine on Pis so I’m interested to hear why any Debian at all?

permalink
report
parent
reply
1 point

Just because I know it and I wanted something with as little bloat as possible.

Tried alpine once, could not get it running.

permalink
report
parent
reply
0 points

You wrote a guide on how to install and use a Linux distro but you can’t install another distro. Isn’t that a little bit of a contradiction, same with the statement “with as little bloat as possible”, that’s exactly what Alpine is made for. Are you sure you should give other people advice?

permalink
report
parent
reply
1 point

Full disk encryption is my reason. Super easy to do when installing debian from scratch. Big pain in the ass to do with Pi OS (last I googled).

permalink
report
parent
reply

Self-Hosted Main

!main@selfhosted.forum

Create post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

For Example

  • Service: Dropbox - Alternative: Nextcloud
  • Service: Google Reader - Alternative: Tiny Tiny RSS
  • Service: Blogger - Alternative: WordPress

We welcome posts that include suggestions for good self-hosted alternatives to popular online services, how they are better, or how they give back control of your data. Also include hints and tips for less technical readers.

Useful Lists

Community stats

  • 23

    Monthly active users

  • 1.8K

    Posts

  • 11K

    Comments

Community moderators