A fresh Linux VPS may look ready to use immediately, but skipping the initial security configuration can expose your system to unnecessary risks. A proper Ubuntu Server Setup helps secure remote access, protect services, and prepare the server for production workloads.
This guide explains the essential first steps after deploying an Ubuntu 26.04 server, including creating a sudo user, configuring SSH keys, enabling the firewall, and updating the system safely.
Connect to Your Ubuntu Server
The first login usually happens through the root account provided by your hosting company. Connect to the server using SSH from your local machine:
ssh root@server_ip_address
After entering the password or using your SSH key, you will gain full administrative access to the system.
Create a Secure Sudo User
Using the root account daily is not recommended because every command has unrestricted system privileges. Instead, create a dedicated user account for administration.
Add a new user:
adduser username
Grant administrative access:
usermod -aG sudo username
This allows the account to execute administrative commands using sudo.
Ubuntu Server Setup with SSH Keys
SSH key authentication provides stronger security than passwords and helps prevent brute-force attacks.
If you already have SSH keys on your local system, copy them to the server:
ssh-copy-id username@server_ip_address
Now test the connection using the new account:
ssh username@server_ip_address
Successful login confirms the SSH configuration is working properly.
Disable Root Login and Password Authentication
Once SSH keys are configured, harden your server by disabling direct root access and password authentication.
Create a custom SSH configuration file:
sudo nano /etc/ssh/sshd_config.d/99-hardening.conf
Add the following lines:
PermitRootLogin no PasswordAuthentication no
Verify the SSH syntax:
sudo sshd -t
Reload the SSH service:
sudo systemctl reload ssh
These changes significantly improve server security.
Configure the Firewall Using UFW
Ubuntu includes UFW (Uncomplicated Firewall), which simplifies firewall management.
Allow SSH traffic first:
sudo ufw allow OpenSSH
Enable the firewall:
sudo ufw enable
Check active firewall rules:
sudo ufw status
If you later install web servers like Nginx or Apache, additional firewall rules may be required.
Set Hostname and Timezone
A proper hostname helps identify servers quickly in logs and monitoring systems.
Set the hostname:
sudo hostnamectl set-hostname web-server
Configure your timezone:
sudo timedatectl set-timezone Asia/Kolkata
Correct timezone settings improve scheduling accuracy for logs and cron jobs.
Update Ubuntu Packages
Keeping packages updated is one of the most important security practices.
Refresh repositories and install updates:
sudo apt update sudo apt upgrade
If the update installs a new kernel, reboot the server:
sudo reboot
Final Thoughts
Completing a proper Ubuntu Server Setup ensures your VPS starts with strong security, safer SSH access, firewall protection, and updated software packages. These initial steps create a solid foundation before deploying websites, databases, containers, or production applications on Ubuntu 26.04.
