# First steps on a new Ubuntu 24.04 VPS

> The first half hour on a new Ubuntu 24.04 VPS: update it, add a sudo user, use SSH keys only, turn on the ufw firewall and check unattended-upgrades.

Source: https://wharfcloud.co.uk/guides/first-steps-new-ubuntu-24-04-vps · Last updated 3 December 2026 · WharfCloud

Published 3 December 2026. Reading time about 7 minutes.

## Short answer

On a new Ubuntu 24.04 VPS, do five things before you install anything else: update the packages, create your own user with sudo rights, copy your SSH key to it and turn off root and password sign-in, allow SSH through the ufw firewall before you enable it, and check that unattended-upgrades is installing security updates every day. Test each change from a second terminal before you close the first, so a mistake never locks you out.

## Before you start

You need the server's IP address and the user name your panel shows, and the SSH key you added when you ordered. The commands below use `YOUR_SERVER_IP` and a new user called `deploy`: replace both with your own.

> **Keep one session open** Leave your first SSH session open until you have signed in successfully from a second terminal with the new settings. If something goes wrong, the open session lets you fix it. The web console in your panel is the fallback.

Sign in for the first time (use the user name shown in your panel if it is not root):

```bash
ssh root@YOUR_SERVER_IP
```

## 1. Update the packages

The image may be a few days or weeks old. Bring everything up to date and reboot if a new kernel was installed.

```bash
apt update && apt full-upgrade -y
[ -f /var/run/reboot-required ] && reboot
```

While you are there, set the clock to UK time so log timestamps match your day: `timedatectl set-timezone Europe/London`.

## 2. Create a user with sudo rights

Working as root all the time makes every typo dangerous. Create your own user, give it sudo rights and copy your SSH key across.

```bash
adduser deploy
usermod -aG sudo deploy
rsync --archive --chown=deploy:deploy ~/.ssh /home/deploy
```

`adduser` asks for a password: choose a strong one, because `sudo` will ask for it. The `rsync` line copies root's `authorized_keys` so the same key signs you in as `deploy`.

From a second terminal on your own computer, check it works:

```bash
ssh deploy@YOUR_SERVER_IP
sudo whoami
```

`sudo whoami` should print `root`. Use this user from now on.

## 3. Allow SSH keys only, and no root sign-in

Ubuntu 24.04 reads extra SSH settings from files in `/etc/ssh/sshd_config.d/`. When the same setting appears twice, the first value read wins, and the files are read in name order. Naming yours `00-hardening.conf` puts it ahead of anything the image added, such as a cloud-init file.

```bash
printf 'PermitRootLogin no\nPasswordAuthentication no\nKbdInteractiveAuthentication no\n' | sudo tee /etc/ssh/sshd_config.d/00-hardening.conf
sudo sshd -t
sudo systemctl restart ssh
```

`sshd -t` checks the configuration and prints nothing when it is valid. Restarting the service keeps your current session open. Now open a new terminal and sign in as `deploy` again before you close anything. Signing in as root should now fail.

## 4. Turn on the ufw firewall

ufw comes with Ubuntu Server and is off on a standard install until you enable it. Allow SSH **before** enabling it, then open only the ports you need. Check the current state first: if ufw is already active, add rules to it rather than resetting it.

```bash
sudo ufw status verbose
sudo ufw allow OpenSSH
sudo ufw allow 80,443/tcp
sudo ufw enable
sudo ufw status verbose
```

Leave out the `80,443/tcp` line if the server does not serve websites. To let only your office reach SSH, replace the OpenSSH rule with `sudo ufw allow from YOUR_OFFICE_IP to any port 22 proto tcp`, after checking that address is fixed.

On a WharfCloud Cloud VPS, outbound port 25 is blocked by default in the server's firewall, and sending email directly from the server is not allowed under our acceptable use policy, so do not remove that block. We monitor for spam and stop servers that send it. Send email from your apps through an email provider on port 587 or 465.

## 5. Check automatic security updates

Ubuntu's `unattended-upgrades` installs security updates once a day. On a WharfCloud Cloud VPS it is switched on at first boot; on any server it is worth checking.

```bash
cat /etc/apt/apt.conf.d/20auto-upgrades
systemctl list-timers apt-daily-upgrade.timer
sudo unattended-upgrade --dry-run --debug
```

The first file should contain `APT::Periodic::Update-Package-Lists "1";` and `APT::Periodic::Unattended-Upgrade "1";`. If the package is missing, install it with `sudo apt install unattended-upgrades` and switch it on with `sudo dpkg-reconfigure --priority=low unattended-upgrades`. Logs are in `/var/log/unattended-upgrades/`.

Kernel updates need a reboot to take effect, and by default the server never reboots on its own. If a short restart in the early morning is acceptable, put these two lines in a new file, `/etc/apt/apt.conf.d/52unattended-upgrades-local`:

```ini
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "03:30";
```

Automatic updates cover packages from Ubuntu's own security archive. Software you installed some other way, such as a language runtime from a vendor's script, a Docker image or a web app's plugins, needs its own update routine.

## What to do next

- **Back up your data off the server.** A snapshot of the whole server is not the same as a copy of your data you can restore elsewhere. Our [rclone and restic guide](https://wharfcloud.co.uk/guides/rclone-restic-s3-backup-uk) shows encrypted, scheduled backups to S3-compatible storage in London.
- **Watch your services.** Use an external uptime check for each website or API, and send alerts somewhere a person reads.
- **Keep a change log.** Write down what you installed and changed. It makes rebuilding the server, or handing it over, much faster.
- **Decide who looks after it.** If patching and watching the server is not how you want to spend your week, a [Managed Linux Server](https://wharfcloud.co.uk/managed-servers/linux) moves that work to us.

## Next step: Cloud VPS

A KVM virtual server in a London data centre with NVMe storage, unmetered traffic and full root access. Pick Ubuntu or Debian, add your SSH key and it is set up automatically after payment. It is unmanaged: you run, patch and secure it yourself. If you want us to look after a server for you, see Managed Linux Server.

- **Cloud VPS:** [See Cloud VPS](https://wharfcloud.co.uk/cloud-vps), Cloud VPS, from £12/month.

Not sure which fits? [Ask an engineer](https://wharfcloud.co.uk/contact?topic=cloud-vps); we reply in UK business hours.

## Frequently asked questions

### Do I still need a firewall if my provider has one?

Yes. A host firewall such as ufw controls exactly which ports your server answers on, and it is the layer you control. On a WharfCloud Cloud VPS we do not manage inbound firewall rules for you, so set them yourself.

### Should I change the SSH port?

It reduces noise in the logs but adds little security once password sign-in is off. If you change it, allow the new port in ufw first and remember Ubuntu 24.04 starts SSH through a systemd socket, so follow Ubuntu's own instructions for changing the port.

### Is unattended-upgrades safe on a production server?

For security updates from Ubuntu's archive, yes for most servers: they are prepared for the release you run and are meant to fix problems without changing how software behaves. Leave automatic reboots off if an unplanned restart would hurt, and reboot by hand in a quiet hour instead.

### What about fail2ban?

With password sign-in turned off, guessing attacks on SSH cannot succeed, so fail2ban mainly reduces log noise. It is still useful for web applications that have their own login pages.

## Sources

- [Ubuntu Server documentation: Automatic updates](https://documentation.ubuntu.com/server/how-to/software/automatic-updates/)
- [Ubuntu Server documentation: Firewall (ufw)](https://documentation.ubuntu.com/server/how-to/security/firewalls/)
- [Ubuntu Server documentation: OpenSSH server](https://documentation.ubuntu.com/server/how-to/security/openssh-server/)

---

WharfCloud is a trading name of Sunucu Internet Services Consultancy Ltd, registered in England and Wales, company number 12963678.
Support: engineers Monday to Friday, 08:00 to 18:00 UK time. Critical incidents: A person responds to critical incidents within 1 hour (Every day, 07:00 to 23:00 UK time). Automated monitoring and automated recovery overnight and at weekends.
Contact: hello@wharfcloud.co.uk · https://wharfcloud.co.uk/contact