Linux Server Basics: Operations Notes

After getting a cloud server, I jotted down the Linux operations knowledge I use most often in daily work, so I can look it up easily.

Users and permissions

Don't do everything as root. A common practice is to create a regular user and elevate temporarily with sudo when admin rights are needed:

sudo adduser deploy
sudo usermod -aG sudo deploy

SSH key login

Password login is vulnerable to brute force; using an SSH key is safer. After generating a key locally, place the public key in the server's ~/.ssh/authorized_keys:

ssh-keygen -t ed25519
ssh-copy-id deploy@server-ip
Once keys are set up, it is a good idea to disable password login in the sshd config — it improves security significantly.

Firewall

On Ubuntu, ufw is commonly used to manage the firewall, allowing only the ports you need:

sudo ufw allow 22
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable

Cloud servers usually also have a "security group/firewall" layer in the console; both layers must allow a port before it is reachable from the internet.

Inspecting ports and processes

To find which program occupies a port:

sudo ss -tlnp | grep :80

To check system resource usage:

top        # live processes
df -h      # disk usage
free -h    # memory usage

Summary

These commands are the everyday essentials of server operations. With the basics solid, it becomes much easier to understand higher-level concepts like containers and reverse proxies.

← Back to home