Set up an Ubuntu 26.04 VPS
Connect to a new Ubuntu 26.04 VPS, update it, create an administrator, configure SSH keys, and enable a firewall.
Introduction
This guide establishes the Ubuntu 26.04 LTS baseline used by the VPS use cases. It creates a named administrator, tests key-based SSH access, and enables UFW without closing the active SSH path.
Prerequisites
Before you begin, make sure you have:
- Access to your VPS credentials (sent via email)
- Ubuntu 26.04 LTS installed on the VPS
- An SSH client installed on your computer
- Basic knowledge of command-line operations
Note: Password and SSH keys for the root account can be set in the VPS Admin Panel at panel.shrp.no (login via billing.shrp.no).
Step 1: Connect to Your VPS
First, you need to connect to your VPS using SSH.
On Linux/macOS
Open your terminal and run:
ssh root@your-server-ip
Replace your-server-ip with the IP address provided in your welcome email.
On Windows
You can use PuTTY or Windows Terminal with OpenSSH:
ssh root@your-server-ip
On the first connection, compare the displayed host-key fingerprint with a trusted value from the provider or console before accepting it. A first-connection prompt alone does not prove the server identity.
Step 2: Update Your System
Once connected, update your system packages:
apt update && apt upgrade -y
This ensures you have the latest security patches and software versions.
Set Your Timezone
Configure the correct timezone to avoid confusion in server logs:
First, list available timezones:
timedatectl list-timezones
You can filter the list to find your region. For example, to find European timezones:
timedatectl list-timezones | grep Europe
Then set your timezone (example using Europe/Oslo):
timedatectl set-timezone Europe/Oslo
Or use the interactive tool:
dpkg-reconfigure tzdata
Verify the timezone:
timedatectl
Step 3: Create a New User
Running everything as root is not recommended. Let’s create a new user:
adduser yourusername
Follow the prompts to set a password and user information.
Grant Sudo Privileges
Add your new user to the sudo group:
usermod -aG sudo yourusername
Test Sudo Access
Before logging out of root, verify that sudo works for your new user:
su - yourusername
sudo whoami
This should return root. If it does, your sudo access is working correctly. Type exit to return to the root shell.
Step 4: Configure SSH Key Authentication
SSH keys are more secure than passwords. Here’s how to set them up:
Generate SSH Key (on your local machine)
Important: Open a new terminal window on your computer (do not run this inside the VPS).
ssh-keygen -t ed25519 -C "your_email@example.com"
Copy the Key to Your Server
On Linux or macOS, copy the key with ssh-copy-id:
ssh-copy-id yourusername@your-server-ip
Windows OpenSSH does not normally include ssh-copy-id. In PowerShell, send the public key to SSH and append it with restrictive permissions:
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | ssh yourusername@your-server-ip "umask 077; mkdir -p ~/.ssh; chmod 700 ~/.ssh; touch ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys; cat >> ~/.ssh/authorized_keys"
Now you can log in without a password!
Now that you have SSH keys configured, proceed to the Secure Your VPS guide to disable password authentication and root login for enhanced security!
Step 5: Configure Firewall
Enable the firewall to protect your server:
ufw allow OpenSSH
ufw enable
Check the status:
ufw status
Next Steps
Congratulations! Your VPS is now set up with basic security. Here are some recommended next steps:
- Secure Your VPS - Enhanced security configurations
- Installing NGINX - Set up a web server
- Installing Docker - Install and configure Docker for containerization
- Install your preferred applications and services
Troubleshooting
Cannot Connect via SSH
If you’re having trouble connecting:
- Check that your server IP is correct
- Verify your SSH service is running:
systemctl status ssh - Check firewall rules:
ufw status
Forgot Your Password
You have several options to regain access:
- Reset via VPS Admin Panel: Login at billing.shrp.no and access the VPS Admin Panel at panel.shrp.no to reset your root password
- Use Console Access: Access your VPS through the web-based console available in the VPS Admin Panel to login locally
- Contact Support: Email our support team at shrp@shrp.no for assistance
Need Help?
If you encounter any issues or have questions:
- Join our Discord community
- Email us at shrp@shrp.no
- Check our other documentation guides