Skip to content
CryptoDedicated
Menu

How do I secure a new dedicated server?

How to secure a new dedicated server during its first hour online, with Debian and Ubuntu commands and a safe order that never locks out the root session.

Updated , by the CryptoDedicated team, 5 min read

Quick answer

How do I secure a new dedicated server?

To secure a new dedicated server, update it, create a sudo user, switch SSH to keys only, enable automatic security patches, add fail2ban and close unused ports. On a CryptoDedicated machine this takes about 15 minutes; since there is no KVM console, keep one root session open while testing each change. Machines start at $83.69.

In brief
  • Order matters: update, user, keys, then SSH settings, then the firewall, each tested from a second terminal.
  • No console fallback: a CryptoDedicated machine has no IPMI or KVM, so a lockout means a reinstall request.
  • Keys only: PasswordAuthentication no in a drop-in file under /etc/ssh/sshd_config.d/.
  • Patches by themselves: unattended-upgrades installs Debian and Ubuntu security updates daily.
  • Audit: ss -tulpn lists every listening port; anything unexpected gets stopped or firewalled.

Which first-hour tasks protect a dedicated server most?

Seven tasks cover the attacks a fresh public IPv4 sees in its first day: password guessing, old packages and forgotten services.

First-hour hardening checklist for a Debian 13 or Ubuntu 24.04 dedicated server, with the command and what it blocks
TaskCommand or fileWhat it blocks
Update packagesapt update && apt full-upgradeKnown flaws in shipped packages
Create a sudo useradduser admin; usermod -aG sudo adminDirect root logins over SSH
Copy the key to the user/home/admin/.ssh/authorized_keysLockout once root login is off
Keys only over SSH/etc/ssh/sshd_config.d/10-hardening.confPassword guessing
Automatic security patchesunattended-upgradesFlaws published after delivery
Ban repeated failuresfail2ban with the sshd jailLog noise and slow brute force
Audit listening portsss -tulpnServices exposed by mistake

What are the hardening steps, in a safe order?

  1. Log in and update

    Connect as root with the key or the temporary password from the dashboard, run the full upgrade and reboot if a new kernel arrived.

  2. Change the temporary root password

    If the machine came without a key, run passwd first; the password shown in the dashboard then stops working.

  3. Create an admin user with sudo

    Add the user, put it in the sudo group and copy root's authorized_keys into its home with the right owner.

  4. Test the new user from a second terminal

    Open a new SSH session as admin and run sudo -v. Keep the root session open until this works.

  5. Write the SSH drop-in and reload

    Turn off passwords and root login, check the syntax with sshd -t, reload the service, then test again from a third terminal.

  6. Install unattended-upgrades and fail2ban

    Enable daily security updates and the sshd jail, then check that both services are active.

  7. Audit the open ports

    List listening sockets and stop or firewall everything that should not face the internet.

Debian 13 / Ubuntu 24.04: user, SSH drop-in, automatic updates and fail2ban
apt update && apt full-upgrade -y
adduser admin
usermod -aG sudo admin
install -d -m 700 -o admin -g admin /home/admin/.ssh
install -m 600 -o admin -g admin /root/.ssh/authorized_keys /home/admin/.ssh/authorized_keys

cat > /etc/ssh/sshd_config.d/10-hardening.conf <<'EOF'
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
EOF
sshd -t && systemctl reload ssh

apt install -y unattended-upgrades fail2ban python3-systemd
dpkg-reconfigure -plow unattended-upgrades
printf '[sshd]\nenabled = true\nbackend = systemd\n' > /etc/fail2ban/jail.local
systemctl restart fail2ban && fail2ban-client status sshd

ss -tulpn

Why does the order of the steps matter so much here?

Because a CryptoDedicated machine has no IPMI or KVM console, an SSH or firewall mistake cannot be fixed from a remote screen. The only way back is a reinstall from the dashboard, which erases both drives.

Three rules keep that from happening:

  • Never close the working root session until a fresh login with the new settings succeeds.
  • Run sshd -t before every reload; it prints the faulty line instead of leaving SSH down.
  • Add the firewall last, and allow port 22 before setting the default policy to drop, as shown in the nftables firewall guide.

What does a non-standard SSH port actually buy?

It cuts log noise but adds no real protection once passwords are off. Scanners try port 22 first, so a different port means fewer failed attempts in the journal. A key-only server already refuses every one of them.

If the port changes, three places must agree: the Port line in the drop-in, the firewall rule, and the client's ~/.ssh/config. On Ubuntu 24.04 SSH is socket-activated, so the port is also set in the ssh.socket unit; run systemctl daemon-reload and systemctl restart ssh.socket after editing. The key itself is covered in how to add an SSH key.

What else should a new machine get in its first week?

A backup, a RAID check and a look at outgoing mail rules.

  • Backups: copy data off the machine, for example with restic, before anything important lands on it.
  • RAID: both NVMe drives are delivered as a software RAID 1 mirror; confirm both members are active with cat /proc/mdstat, as described in how to check RAID 1 status.
  • Mail: the network blocks outgoing port 25 on all machines, so applications hand mail to an external relay on port 465 or 587.

According to CryptoDedicated's survey of 30 October 2026, the median stated setup time among dedicated-server sellers was 24 hours; a CryptoDedicated machine arrives within one hour, which leaves the hardening as the only wait.

Frequently asked questions

What if I lock myself out of SSH?

Request a reinstall from the dashboard with a new SSH public key. A reinstall erases both drives, so keep backups before changing SSH or firewall settings.

Do I need fail2ban if passwords are disabled?

It is not strictly needed, since key-only SSH already rejects guesses. It keeps the logs readable and also protects other services such as web logins.

Does CryptoDedicated sell DDoS protection?

No. The datacenter's standard network filtering is the only shield, and no add-on is sold for it. Rate limits and a firewall on the machine remain the customer's job.

Which systems does this guide cover?

Debian 12, Debian 13 and Ubuntu 24.04 LTS as delivered. On AlmaLinux 10 or Rocky Linux 10, use dnf and the wheel group instead of apt and sudo.

Verdict
  • Keys only, automatic patches and a port audit stop most attacks a public dedicated server meets in its first week.
  • On a CryptoDedicated machine, test every SSH change from a second session: without a console, a mistake costs a reinstall.
  • The Ryzen 5600 at $83.69 is a fine machine to practise this checklist on.
Sources (4)
  1. sshd_config(5) — OpenSSH manual pages (read 2026-11-30)
  2. UnattendedUpgrades — Debian Wiki (read 2026-11-30)
  3. OpenSSH server — Ubuntu Server documentation (read 2026-11-30)
  4. fail2ban — fail2ban project (read 2026-11-30)

A server to harden in 15 minutes

Ryzen 5600, 6 cores / 12 threads, 32 GB DDR4, RAID 1 NVMe: $83.69 per 30 days in crypto.

Read next

$83.69 Ryzen 5600, per 30 days

Order