Managing a remote server can sound intimidating at first, but with the right tools and tips, it becomes second nature. Being able to efficiently manage a remote server from the Ubuntu terminal is one of the most powerful skills you can have in today’s cloud-centric environment. This guide will walk you through the steps of connecting to, monitoring, and maintaining a remote server using Ubuntu’s built-in terminal tools. We’ll cover everything from setup to routine maintenance, while keeping security and performance at the forefront.
Step 1 – Connect to Your Remote Server
First things first, you need to establish a secure connection.
Use SSH (Secure Shell)
SSH is the standard method for accessing a remote Linux server.
ssh username@remote-server-ip
Replace username with your remote server’s user and remote-server-ip with the actual IP address or hostname. If it’s your first time connecting, you’ll be asked to confirm the server’s fingerprint.
Optional: Use an SSH Key Pair for Passwordless Login
For improved security and convenience:
1. Generate an SSH key pair on your local machine:
ssh-keygen
2. Copy the public key to your remote server:
ssh-copy-id username@remote-server-ip
Now you can log in without typing your password every time.
You may check our previous post for more of generating an SSH Key Pair.
Step 2 – Keep Your Server Software Up to Date
One of the most crucial tasks when you manage a remote server from the Ubuntu terminal is ensuring it’s running the latest security patches and software updates.
Run Update & Upgrade
sudo apt update && sudo apt upgrade –y
Use this regularly to pull the latest package updates. For kernel or system-level upgrades, consider:
sudo apt dist-upgrade
Tip: Enable unattended upgrades to keep your server auto-updating critical packages.
sudo apt install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades
Step 3 – Monitor Server Health
Monitoring lets you detect issues before they become disasters.
Use htop for Real-Time Resource Monitoring
sudo apt install htop
htop
This gives you a colorful, interactive view of your server’s CPU, RAM, processes, and load averages.
Check Disk Space
df –h
This command shows mounted file systems and how much space they’re using. Don’t let your root partition fill up, it can crash your server.
Clean Up Old Files
sudo apt autoremove
sudo apt clean
Remove unnecessary packages and cached data that pile up over time.
Step 4 – Check Logs for Issues
Your server logs are treasure troves of information.
sudo tail -f /var/log/syslog
Use this to watch your system log in real time. Logs can help diagnose boot issues, crashes, or unauthorized access attempts.
For web servers:
sudo tail -f /var/log/apache2/error.log
or
sudo tail -f /var/log/nginx/error.log
Step 5 – Manage Services and Uptime
Make sure critical services are running as expected.
Check Service Status
systemctl status nginx
Substitute nginx with the name of the service you want to inspect.
Start/Stop/Restart Services
sudo systemctl restart nginx
Restarting services is a common fix after configuration changes.
Step 6 – Secure Your Remote Server
A secure server is a happy server.
Change the Default SSH Port
Edit the SSH config:
sudo nano /etc/ssh/sshd_config
Change the port from 22 to something else like 2222 and restart the SSH service:
sudo systemctl restart sshd
Disable Root Login via SSH
Still in /etc/ssh/sshd_config, set:
PermitRootLogin no
Tips to Keep Your Server in Top Shape
Automate Backups – Use rsync, cron, or third-party tools.
Install a Firewall – UFW (Uncomplicated Firewall) is a good choice:
sudo ufw enable
sudo ufw allow ssh
sudo ufw status
Use Fail2Ban – Protects from brute-force login attempts:
sudo apt install fail2ban
Conclusion
If you’re working with Linux servers, the ability to manage a remote server from the Ubuntu terminal is a must-have skill. From updating software and monitoring performance to checking logs and securing access, you have everything you need to stay on top of your server’s health right from your terminal window.
Remote server management doesn’t have to be stressful. With the right commands, smart automation, and a solid maintenance routine, you’ll keep your servers running smoothly and securely.
Got tips or tools you use to manage your remote server from the Ubuntu terminal? Share them in the comments below.