Skip to main content

Linux and servers · Beginner · 10 min

How to Do the Initial Setup of a New Ubuntu 26.04 Server

By Padding · Updated 15 Nov 2026
Ubuntu 26.04.1 LTS

You will take a fresh Ubuntu 26.04 server from a root-only login to an updated machine with a daily-use account, your SSH key on it, a firewall and a known clock.

On this page

A server from a hosting provider starts with one account that can do anything: root. Working as root all day is risky. A mistyped command has no safety net, and anyone who learns the root password owns the machine. Before the server holds anything real, you give yourself a second account for daily work, put your SSH key on it, and switch on a firewall.

This is the first tutorial in the series Your first production server. It gets the server ready for the later ones: SSH hardening, a web server, HTTPS. The commands are written for Ubuntu 26.04.1 LTS.

Step 1 · Connect as root and confirm the release

From your own computer, connect to the address the provider gave you. 203.0.113.10 below is a documentation address, so use yours.

Bash
ssh root@203.0.113.10

On a first connection SSH prints the server's host key fingerprint and asks whether to trust it. Answer yes. Then give the root password, or let your key sign you in if the provider installed one.

Check it worked

The prompt now begins root@. Ask the system what it is:

Bash
cat /etc/os-release

Look for VERSION="26.04.1 LTS (Resolute Raccoon)". If you see another release, you picked the wrong image at the provider, and it is cheaper to rebuild now than later.

Step 2 · Bring the packages up to date

The image was built some time before you booted it, so fixes have been published since. Fetch the current package lists and apply them.

Bash
sudo apt update
sudo apt upgrade -y

A kernel update only takes effect after a reboot. Ubuntu leaves a marker file when one is needed.

Bash
test -f /var/run/reboot-required && echo "reboot needed"
sudo reboot

Your session ends when the machine restarts. Reconnect after a minute.

Step 3 · Create the account you will use every day

Pick a user name. This tutorial uses deploy. adduser makes the account and its home folder, and asks you to choose a password. That password is what sudo will ask for later, so make it long.

Bash
adduser deploy

It then asks for a full name and some contact fields. Press Enter at each to leave them blank, and Y to confirm.

Members of the sudo group may run any command as root by putting sudo in front of it. Add the new account to that group.

Bash
sudo usermod -aG sudo deploy

The -a matters: with -G alone, usermod would replace the account's other groups. The next tutorial, /tutorials/create-a-sudo-user-on-ubuntu-26-04, covers sudo rules in more depth.

Check it worked

Bash
id deploy

The output has the form below. Your numbers may differ. The word sudo in the group list is the part that counts.

Text
uid=1001(deploy) gid=1001(deploy) groups=1001(deploy),27(sudo),100(users)

Step 4 · Put your SSH key on the new account

If you already log in to root with a key, the new account can reuse that key. Copy root's .ssh folder across with rsync, which keeps the permissions and lets you set the new owner in the same command.

Bash
rsync --archive --chown=deploy:deploy ~/.ssh /home/deploy

If rsync is missing, install it first with sudo apt install rsync.

If root has no key yet, do it from your own computer instead with ssh-copy-id deploy@203.0.113.10. Creating keys and the details of key login are in /tutorials/log-in-to-a-server-with-ssh-keys.

Check it worked

Bash
ls -ld /home/deploy/.ssh
stat -c '%a %U %n' /home/deploy/.ssh/authorized_keys

The folder is drwx------, and the key file reads 600 deploy /home/deploy/.ssh/authorized_keys. SSH refuses key files that other users can write, so these modes matter.

Now test the account before you rely on it. Leave the root session open, and from a second terminal on your computer run:

Bash
ssh deploy@203.0.113.10
sudo whoami

sudo asks for the password you chose and prints root. If either command fails, fix it from the root session while it is still open.

Step 5 · Turn on the firewall

Ubuntu includes UFW, a simpler front end to the kernel firewall. Order matters here: allow SSH before you enable the firewall, or it will cut off your own session.

Bash
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status

UFW warns that enabling may interrupt SSH connections. Your rule keeps port 22 open, so answer y. The status shows Status: active with OpenSSH allowed for IPv4 and IPv6. The full tutorial is /tutorials/set-up-ufw-firewall-ubuntu-26-04.

Step 6 · Check the clock

Logs and scheduled jobs use the server's clock. Servers usually stay on UTC, which avoids surprises when daylight saving changes. See what yours uses:

Bash
timedatectl

Most images show Time zone: Etc/UTC (UTC, +0000). To use another zone, find its name with timedatectl list-timezones and set it, for example sudo timedatectl set-timezone Africa/Lagos.

Next steps

You now have an account for daily work, and root no longer has to be your login.

  • Understand the sudo group and limited rules: /tutorials/create-a-sudo-user-on-ubuntu-26-04.
  • Set up key login properly: /tutorials/log-in-to-a-server-with-ssh-keys.
  • Close password and root logins: /tutorials/harden-ssh-on-ubuntu-26-04.
  • Learn UFW in full: /tutorials/set-up-ufw-firewall-ubuntu-26-04.

Need this done for you?

Padding does this work for growing companies, from the first diagnosis to a system that keeps working.

Platform Engineering

Get new tutorials

New tutorials, about twice a month.