Dedicated Servers Turkey | GPU & Data Center | SistemDC

First 30 Minutes After Buying a VPS: Linux Security Checklist

First 30 Minutes After Buying a VPS: Linux Server Setup and Security Checklist (2026)

First 30 Minutes After Buying a VPS: Linux Server Setup and Security Checklist (2026)

Within minutes of ordering a VPS, your new server is on the internet, and within the first hours automated scanners around the world start probing port 22. That does not mean your server is special; every address that goes online is scanned routinely. This is why the first 30 minutes after buying a VPS decide how secure and manageable the machine will be for months afterwards. In this guide you will find what to do, why, and with which command, for an Ubuntu or Debian based Linux VPS.

The steps are sequential and each takes a few minutes. Commands are written for Ubuntu and Debian; on AlmaLinux and Rocky Linux the package manager and firewall tool differ, but the logic is identical. If you are still choosing a server, read our checklist of 12 things to check when buying a VPS first.

What You Need Before You Start

After the order, the server's IP address, username and initial password are sent to you, and you can also find them in the Client Area. Before you begin, prepare the following:

  • The server's IP address and the initial root password (or the user you selected during setup).
  • An SSH client on your own computer. Current Windows versions, macOS and Linux all ship with a terminal ssh command.
  • A password manager. Do not keep server passwords in a notepad or a chat app.
  • Access to the Client Area. If you make a mistake and lose SSH access, you can open the console from the panel and, if needed, use rescue mode.

The last point matters: when changing security settings there is always a chance of locking yourself out. Knowing from the start that the panel console works as a fallback lets you apply the steps with confidence.

1. Minutes 0-3: Connect and Get to Know the System

Make the first connection from your own computer. The server will ask you to confirm its fingerprint the first time; this is normal.

ssh root@SERVER_IP_ADDRESS

Once inside, quickly check the system, its resources and the open ports:

cat /etc/os-release
uname -r
nproc
free -h
df -h
ss -tulpn

The goal is to confirm that the resources you ordered (cores, RAM, disk) are what you got, and that no unexpected service is listening. On a clean image, usually only SSH listens.

2. Minutes 3-8: Update the System

Ready-made images may have been built days or even weeks ago. Your first job is to refresh the package list and apply security patches.

apt update
apt full-upgrade -y
apt autoremove -y

If the kernel was updated, you may need to reboot. Since no live service runs on the machine yet, now is the cheapest time to do it. After the reboot, reconnect with the same SSH command. Enabling automatic security updates also prevents patches from piling up unnoticed:

apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades
Automatic updates cover security patches only. You still need to update application versions (PHP, Node.js, databases) yourself on a planned schedule.

3. Minutes 8-12: A Sudo User Instead of Root

Working as root every day creates two problems: a typo can affect the whole system, and attackers do not have to guess a username because root exists everywhere. Create a user in your own name and add it to the sudo group:

adduser deploy
usermod -aG sudo deploy

Avoid very common names such as admin, test or ubuntu. This is not protection by itself, but it reduces noise. Before closing root access, test the new user in a second terminal; do not touch root login until you have seen it work.

4. Minutes 12-18: Switch to SSH Key Login

With password login, anyone on the internet can try an unlimited number of guesses. With key-based login, an attacker needs your private key. Generate a key pair on your own computer:

ssh-keygen -t ed25519 -C "vps-deploy"
ssh-copy-id deploy@SERVER_IP_ADDRESS

If ssh-copy-id is not available on Windows, append the contents of .ssh/id_ed25519.pub to /home/deploy/.ssh/authorized_keys on the server; the directory permissions should be 700 and the file permissions 600. After confirming key login works from a new terminal, tighten the SSH settings:

sudo nano /etc/ssh/sshd_config.d/99-hardening.conf
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
MaxAuthTries 3
LoginGraceTime 30

Before applying, check the syntax and then reload the service. Keep your current session open and test the new setting from a second window:

sudo sshd -t
sudo systemctl reload ssh

On some distributions the service is called sshd. For more SSH hardening options, see our Linux server security and SSH guide.

Deploy your Linux VPS in Istanbul

KVM virtualization, a 1 Gbps port, and console and rescue mode access from the Client Area.

Explore VPS plans

5. Minutes 18-22: Turn On the Firewall with UFW

The firewall logic is simple: deny everything incoming by default and allow only the ports you need. On Ubuntu the easiest tool is UFW. Do not enable the firewall before adding the SSH rule, or you will lock yourself out.

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status verbose

If you will run a web server, also open ports 80 and 443:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Do not expose database ports (3306, 5432, 6379) to the internet. If your application runs on the same server, these services only need to listen on 127.0.0.1. If remote access is required, limit the source to a single IP address:

sudo ufw allow from 203.0.113.10 to any port 3306 proto tcp

One warning if you plan to use Docker: Docker adds its own iptables rules for published ports and can bypass UFW rules. Binding container ports to the local interface only, such as 127.0.0.1:8080:80, is a good habit. See our guide to installing Docker Compose on an Ubuntu VPS for the setup.

6. Minutes 22-25: Block Repeated Attempts with Fail2ban

UFW leaves a port open; Fail2ban reads the logs, detects addresses that repeatedly fail to log in to that port and blocks them temporarily. Even with key-based login it reduces log noise and pointless load.

sudo apt install -y fail2ban
sudo nano /etc/fail2ban/jail.local
[DEFAULT]
bantime  = 1h
findtime = 10m
maxretry = 5

[sshd]
enabled = true
sudo systemctl enable --now fail2ban
sudo fail2ban-client status sshd

If you connect from a fixed address, you can add it to the ignoreip line so you never block yourself by accident. To unblock an address, use fail2ban-client set sshd unbanip ADDRESS.

7. Minutes 25-27: Time Zone, Clock and Hostname

Correct timestamps in your logs make a big difference when troubleshooting. Clock synchronization is ready on most modern images, but verify it and adjust if necessary:

timedatectl
sudo timedatectl set-timezone Europe/Istanbul
sudo hostnamectl set-hostname web01

The output of timedatectl should show System clock synchronized: yes. The hostname should be consistent, especially if you will send email and define a reverse DNS (rDNS) record.

8. Minutes 27-29: Check Memory Headroom and Swap

On a VPS with little RAM, the kernel may kill processes when memory runs out. If you will run a busy application, a small swap file adds a safety margin; swap does not replace memory, it only cushions sudden spikes. Check the current state first:

swapon --show
free -h

If there is no swap and you need it, you can create a 2 GB file like this:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Adjust the swap size to your disk and workload. On database servers, constantly high swap usage is a sign that RAM is insufficient and you should consider a larger plan.

9. Minutes 29-30: First Backup and Monitoring

A backup of the clean state gives you a reference point to return to if a later setting goes wrong. An optional paid Backup Service add-on is available for VPS plans and can be selected at order time. Independently of that, it is good practice to keep the important configuration files separately:

sudo tar czf ~/etc-backup-$(date +%F).tar.gz /etc/ssh /etc/ufw /etc/fail2ban

Copy this archive off the server, to your own computer or separate storage; a backup sitting on the same disk will not save you from a disk problem. For monitoring, three checks are enough to start:

  • Look at the CPU and network graphs in the panel regularly.
  • Set up a simple external availability check, for example with a tool such as Uptime Kuma.
  • Review error logs since boot with journalctl -p err -b.

What Else to Add, Depending on Your Use Case

The list above is the common baseline for everyone. Depending on what you run, add the following:

Use caseExtra stepWhy
Website / WordPressNginx or Apache, Let's Encrypt certificate, regular database backupsIt is a public service, so the attack surface is larger
Docker applicationsBind ports to 127.0.0.1, use a reverse proxy in frontDocker can bypass UFW rules
Mail serverrDNS, SPF, DKIM, DMARCInbox delivery reputation depends on them
Remote work / developmentAccess through a VPN such as WireGuardKeeps management ports off the public internet
Database serverListen on local or private network only, strong passwordsAn exposed database port is a common breach path

7 Common Mistakes

  1. Enabling the firewall without an SSH rule. Your connection drops instantly; you can fix it from the panel console, but you lose time.
  2. Disabling password login before testing the key. Always test in a second terminal.
  3. Reusing the same password in several places. Use a password manager.
  4. Postponing updates. Updating a new server carries the least risk; with a live service it is much harder.
  5. Exposing the database port to everyone. Opening it for a test and forgetting to close it is very common.
  6. Leaving backups on the server's own disk. A backup must live apart from the source system.
  7. Relying only on a port change. Changing the SSH port reduces noise but is not protection; real security comes from keys and a blocking layer.

If You Lock Yourself Out: Console and Rescue Mode

A wrong firewall rule or a faulty SSH setting can leave you outside. VPS management is done from the Client Area: open the console in your browser and disable UFW (sudo ufw disable) or revert the SSH setting. The console uses a US keyboard layout, so keep that in mind for passwords with special characters. In a more serious failure, rescue mode lets you reach your files without wiping the disk.

Need more power than a VPS?

Dedicated servers add browser-based KVM console and power controls through the Client Area.

See dedicated server plans

Final Checklist

At the end of the 30 minutes you should be able to answer yes to all of the following:

  • The system is up to date and automatic security updates are on.
  • There is a separate sudo user for daily work.
  • SSH login uses a key, with passwords and root login disabled.
  • UFW is enabled and only the necessary ports are open.
  • Fail2ban is running and the sshd jail is active.
  • The time zone and hostname are correct.
  • A backup or configuration archive of the clean state is stored off the server.
  • You know you can reach the panel console.

This list does not replace a corporate security program; its purpose is to close the most common mistakes on a freshly exposed server within the first hour. After you install your application, version updates, log review and regular restore tests continue as ongoing work. If you see signs of an attack, follow the diagnostic steps in how to tell if you are under a DDoS attack; for protection options, see the DDoS protection information on our site. Support requests are accepted 24/7, and you can reach us through the contact page whenever you get stuck.

Related Guides

Frequently Asked Questions

What should I do first after buying a VPS?

Confirm in the panel that the server is running and note its IP address, then connect over SSH, update the system, create a sudo user instead of using root, and switch to SSH key login instead of a password.

Is disabling root SSH login mandatory?

It is not mandatory but strongly recommended. The root username is known to everyone, so it is the first target of brute-force attempts; a separate sudo user with key-based login shrinks the attack surface noticeably.

Does changing the SSH port improve security?

Changing the port only reduces noise from automated scanners and does not provide real protection. Real security comes from key-based login, disabling passwords and a blocking layer such as Fail2ban.

Should UFW and Fail2ban be used together?

Yes, they do different jobs. UFW decides which ports are reachable from outside, while Fail2ban temporarily blocks addresses that repeatedly fail to log in to an open port.

What if I lock myself out of the server?

You can use the console in the Client Area to log in and fix the firewall or SSH setting. Rescue mode is another way to reach your files without wiping the disk.

Should I wait before taking the first backup?

No. Even before there is real data on the server, a snapshot or backup of the clean initial state gives you a reference point to return to if a later change goes wrong.

Server packages covered in this article

+902243340242