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.
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.
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.
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.
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.
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.
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.
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
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.
Introduction Bash scripting is a powerful way to automate Linux tasks, but writing a script…
Introduction A self-signed SSL certificate is a certificate that is created and signed by the…
Introduction Debugging is an important part of Bash scripting. When a script does not work…
Introduction Cron jobs are used in Linux to run commands or Bash scripts automatically at…
Introduction Pipes are an important feature in Linux and Bash scripting. A pipe allows you…
Introduction The grep, awk, and sed commands are powerful text-processing tools in Linux. They are…