How to Manage Remote Server from the Ubuntu Terminal?

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.

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:

2. Copy the public key to your remote server:

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

Use this regularly to pull the latest package updates. For kernel or system-level upgrades, consider:

Tip: Enable unattended upgrades to keep your server auto-updating critical packages.

Step 3 – Monitor Server Health

Monitoring lets you detect issues before they become disasters.

Use htop for Real-Time Resource Monitoring

This gives you a colorful, interactive view of your server’s CPU, RAM, processes, and load averages.

Check Disk Space

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

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.

Use this to watch your system log in real time. Logs can help diagnose boot issues, crashes, or unauthorized access attempts.

For web servers:

or

Step 5 – Manage Services and Uptime

Make sure critical services are running as expected.

Check Service Status

Substitute nginx with the name of the service you want to inspect.

Start/Stop/Restart Services

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:

Change the port from 22 to something else like 2222 and restart the SSH service:

Disable Root Login via SSH

Still in /etc/ssh/sshd_config, set:

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:

Use Fail2Ban – Protects from brute-force login attempts:

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.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *