{"id":4659,"date":"2026-11-17T01:55:59","date_gmt":"2026-11-17T01:55:59","guid":{"rendered":"https:\/\/skynethosting.net\/blog\/?p=4659"},"modified":"2026-11-18T02:03:42","modified_gmt":"2026-11-18T02:03:42","slug":"vps-security-basics-2027","status":"publish","type":"post","link":"https:\/\/skynethosting.net\/blog\/vps-security-basics-2027\/","title":{"rendered":"VPS Security Basics: A Practical Hardening Checklist for New Server Owners"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>By Author name, role, years in hosting. Reviewed by Reviewer name, role. Last reviewed: November 15, 2026.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">VPS security basics come down to a short list: create a separate admin user, log in with SSH keys, turn on a firewall, install updates, protect your database and applications, and set up backups you have actually tested. A new VPS is reachable from the whole internet the moment it boots, and attackers scan new servers within minutes. Doing these steps in order takes a beginner roughly an hour or two.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide gives you copyable commands for Ubuntu, explains what each one does, shows what you should see afterward and warns about the mistakes that lock people out. Commands differ on other Linux distributions, so check your own system&#8217;s documentation if you do not use Ubuntu.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We sell VPS plans, so we want your server to stay safe, but nothing here depends on where you host. If you are comparing options first, our <a href=\"https:\/\/skynethosting.net\/blog\/unmanaged-vps-hosting\/\">unmanaged VPS guide<\/a> explains how much of the work lands on you.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Should You Secure a VPS Before Hosting Websites or Applications?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Because the server is exposed from the first boot, and the default setup was built for convenience, not safety. Securing it first costs an hour. Securing it after a breach costs days, and sometimes your data. Start with access, then the network, then the software.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">New VPS servers face common risks from the first minute<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A fresh VPS has a public IP address, a root account and an open SSH port. Automated scanners sweep the internet for exactly that combination. In our experience, a new public server usually starts collecting failed login attempts within minutes to hours of going online.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Most of those attempts are dull and automated. They try common usernames and passwords, probe for old software and move on. The risk is not a clever hacker aiming at you personally. It is a bot that only needs one weak password.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check your own logs later in this guide to see how many attempts your server receives. Plan for that from the start. Every step in this guide removes one of the easy ways in.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Exposed services and default settings attract attackers<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Every service that listens on a network port is a door. A web server on port 80 is expected. A database on port 3306 open to the whole internet is not, and neither is a control panel nobody remembers installing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Defaults add to the problem. Root login over SSH, password logins and wide open ports are common out of the box, and attackers know it. They also know the default paths of popular applications.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can see your own exposure in seconds. Run this command and read the list of listening ports:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ss -tulpn<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: lists every service listening for connections, with the program behind it. You should see SSH on port 22 and maybe a web server on 80 and 443. Common mistake: ignoring entries marked 0.0.0.0 or [::], which mean the service accepts connections from anywhere.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Brute force attacks, malware and unauthorized access are the usual threats<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A brute force attack guesses passwords at high speed. Malware usually arrives through an outdated plugin, a stolen password or a careless download. Unauthorized access is the result of either: someone logs in who should not.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each has a matching defense in this guide. SSH keys and a firewall blunt brute force attacks. Updates close the holes malware uses. Strong access control and monitoring limit and reveal unauthorized access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">None of these defenses is complete alone. That is why the guide stacks them, and why the last section covers backups for the day something still gets through. Each layer you add makes the attacker&#8217;s job slower and noisier.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Root access and open ports raise the stakes<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Root is the all powerful account on a Linux server. Anyone who logs in as root can read, change or delete anything. That makes the root account the most valuable target on your VPS. Treat it like the master key to a building: keep it locked away and use it rarely.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open ports raise the stakes in the same way. Each one is a place where an attacker can try a bug, a weak password or a misconfiguration. Fewer open ports means fewer chances.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The fix is simple in principle. Do not use root for daily work, and open only the ports your server truly needs. The next two sections show how.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Providers and server owners share the work, but not equally<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On an unmanaged VPS, the provider looks after the hardware, the network and the virtualization layer. Our <a href=\"https:\/\/skynethosting.net\/nvme-vps.html\">NVMe VPS page<\/a> lists hardware level DDoS filtering and a firewall you can set in the browser dashboard. Everything inside the operating system is yours.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That includes the operating system, updates, SSH settings, users, firewall rules, applications, databases and backup testing. Nobody will patch your Ubuntu packages or notice a weak password unless you set that up.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you move from shared hosting, this is a real change. On a plan like <a href=\"https:\/\/skynethosting.net\/cpanel-web-hosting.htm\">shared hosting<\/a> or a <a href=\"https:\/\/skynethosting.net\/reseller-features.htm\">reseller plan<\/a>, the host manages the server. On a VPS, you do. Check which of your plans are managed or unmanaged before you buy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Do You Secure SSH Access and Administrator Accounts on a VPS?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create a separate admin account, log in with an SSH key, then turn off root login and password login, in that order. Keep a second terminal open the whole time so a mistake cannot lock you out. The <a href=\"https:\/\/documentation.ubuntu.com\/server\/how-to\/security\/openssh-server\" target=\"_blank\" rel=\"noopener\">Ubuntu OpenSSH documentation<\/a> covers the same settings in more depth.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create a separate non root administrator account<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Log in as root once, create a normal user and give it sudo rights. Replace deploy with the name you want.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">adduser deploy<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">usermod -aG sudo deploy<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">id deploy<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: the first command creates the user and asks for a password. The second adds the user to the sudo group. The third confirms it. You should see sudo in the list of groups.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Common mistake: skipping the strong password. Even if you plan to use keys only, set a long password, because sudo may ask for it. Now open a new terminal and confirm you can log in as deploy before going further.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Configure SSH key based authentication<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">An SSH key pair has a private half that stays on your computer and a public half that goes on the server. Create the pair on your own computer, not on the VPS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ssh-keygen -t ed25519 -C &#8220;you@example.com&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ssh-copy-id deploy@SERVER_IP<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: the first command makes the key pair and asks for a passphrase. Choose one. The second copies your public key to the server. You should see a message saying 1 key was added.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now test it from a new terminal window, leaving your old session open:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ssh deploy@SERVER_IP<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You should log in without typing the account password. Common mistake: wrong permissions on the server. If the key is ignored, run chmod 700 ~\/.ssh and chmod 600 ~\/.ssh\/authorized_keys as the deploy user.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Restrict direct root login and review password authentication<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Never turn off password login until the key login above works from a separate session. This is the rule that prevents most lockouts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On modern Ubuntu, create a small drop in file. Ubuntu&#8217;s documentation notes that OpenSSH uses the first value it finds, and files in sshd_config.d are read in name order, so the name matters.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo nano \/etc\/ssh\/sshd_config.d\/00_hardening.conf<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add these lines, save, then check the syntax and reload:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PermitRootLogin no<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PasswordAuthentication no<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PubkeyAuthentication yes<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo sshd -t<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo systemctl reload ssh<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: the sshd test prints nothing when the file is valid. Reload applies it without dropping current sessions. Then confirm the settings the server really uses:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo sshd -T | grep -E &#8216;permitrootlogin|passwordauthentication&#8217;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You should see permitrootlogin no and passwordauthentication no.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A trap worth knowing: cloud images often ship a file called 50-cloud-init.conf that sets PasswordAuthentication to yes. If your own file sorts later, it loses. The 00 prefix puts yours first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do not treat changing the SSH port as a substitute for any of this. It only reduces log noise.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Apply appropriate sudo permissions and account access controls<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sudo lets a normal user run admin commands after confirming identity. Give it only to people who need it. Check who has it right now:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">getent group sudo<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: prints the members of the sudo group. You should see only the accounts you created. Remove anyone who should not be there with sudo deluser NAME sudo.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Avoid the shortcut of passwordless sudo for everyone. It means anyone who steals a session can run any command. If an automation job needs limited rights, give it a narrow rule through sudo visudo, not blanket access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Common mistake: editing the sudoers file with a normal text editor. Use visudo, which checks the syntax and refuses to save a file that would lock you out of sudo.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Protect private SSH keys and manage authorized users<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Your private key is the password to your server. Keep it only on your own device, protect it with a passphrase and never email it or paste it into a chat. If you suspect it leaked, replace it right away.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can add or change the passphrase on an existing key at any time:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ssh-keygen -p -f ~\/.ssh\/id_ed25519<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Review who can log in by reading the public keys on the server:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">cat ~\/.ssh\/authorized_keys<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: lists one line per authorized key, each ending in a comment such as an email address. Remove any line you do not recognize. When a contractor leaves, delete their key and their account the same day. A forgotten key is a standing invitation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Do You Configure a Firewall to Protect Your VPS?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Deny all incoming traffic by default, allow only the ports you need, and turn the firewall on only after SSH is allowed. On Ubuntu, UFW does this in a few commands, as the <a href=\"https:\/\/documentation.ubuntu.com\/server\/how-to\/security\/firewalls\" target=\"_blank\" rel=\"noopener\">Ubuntu firewall documentation<\/a> describes. Test from a second terminal before you close the first.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Open ports and unnecessary network services show your exposure<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before writing rules, list what is listening. This is the same command from earlier, and it is worth running again after each change. Write down what each port is for, so a surprise stands out later.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ss -tulpn<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: shows protocol, address, port and program. A healthy small web server often shows only SSH, a web server and nothing else on public addresses. A database listed on 127.0.0.1 is private to the server and fine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Common mistake: confusing 127.0.0.1 with 0.0.0.0. The first means local only. The second means the whole world. Anything unexpected on 0.0.0.0 is either a service to close or a rule to add.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">UFW is the simplest firewall on Ubuntu<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">UFW, short for Uncomplicated Firewall, ships with Ubuntu and is off by default. It is a friendly layer over the firewall built into the Linux kernel. Set the default policies first. Nothing is blocked yet, so this is safe:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ufw default deny incoming<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ufw default allow outgoing<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: blocks all new inbound connections and allows all outbound ones, once the firewall is on. You should see a confirmation line for each policy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">UFW is not meant to handle every advanced case, and our NVMe VPS page lists a separate firewall you can manage in the browser dashboard. Using both gives you two layers: one in front of the server and one on it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Allow only essential services such as SSH, HTTP and HTTPS<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now allow SSH first. This order matters, because enabling the firewall before allowing SSH can lock you out immediately.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ufw allow OpenSSH<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ufw allow 80\/tcp<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ufw allow 443\/tcp<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ufw enable<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ufw status verbose<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: allows SSH, web traffic and secure web traffic, then turns the firewall on. UFW warns that enabling it may disrupt SSH connections. Answer y, because you already allowed SSH. You should see Status: active and your three rules listed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To slow down repeated SSH attempts, you can swap the first rule for sudo ufw limit OpenSSH, which refuses an address that opens too many connections in a short time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Database and administrative ports should stay private<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Databases like MySQL (port 3306) and PostgreSQL (port 5432) should almost never face the internet. On Ubuntu they normally listen on the local machine only. Verify with:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ss -tlnp | grep -E &#8216;3306|5432&#8217;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: shows whether those ports are listening and on which address. You should see 127.0.0.1 or no output at all. If you see 0.0.0.0, fix the database configuration and do not rely on the firewall alone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If a trusted outside machine truly needs access, allow only its address and nothing wider:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ufw allow from 203.0.113.10 to any port 3306 proto tcp<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Replace the example address with the real one. Common mistake: opening port 3306 to everyone for a quick test and forgetting to close it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Test firewall rules without losing server access<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The safest habit is a second session. Keep your current terminal logged in, open a new one and try to connect. If the new login works, the rules are fine. If it fails, fix the rules from the session you kept.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Plan for the worst case too. If you do get locked out, most providers offer a web console that bypasses SSH. Find where yours is before you need it, and confirm you can reach it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To remove a rule you added by mistake, list them with numbers and delete by number:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ufw status numbered<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ufw delete 3<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: the first command numbers the rules and the second removes rule 3. Check the number twice. Deleting the SSH rule by accident is the classic way to lock yourself out.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Which Linux Security Settings Should You Configure After Installing a VPS?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Install pending updates, turn on automatic security updates where it suits you, remove software you do not use, set sensible file permissions and add login protection with Fail2ban. These settings close known holes and shrink what an attacker can reach.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install security updates and keep software current<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Most successful attacks use flaws that already have a fix. Update first, before you install anything else:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo apt update<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo apt list &#8211;upgradable<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo apt upgrade<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: refreshes the package list, shows what can be upgraded and installs it. After a kernel or core library update, a reboot may be required. This check prints a file name only when a reboot is pending:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ls \/var\/run\/reboot-required<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Test updates where you can. On a production server, take a snapshot or backup first and read what will change. A major database or PHP upgrade can break an application, so schedule those and do not apply them blindly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Automatic security updates fit many servers<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu can install security updates for you through the unattended upgrades feature. It is a good fit for small servers that nobody watches every day.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo apt install unattended-upgrades<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo dpkg-reconfigure &#8211;priority=low unattended-upgrades<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo unattended-upgrade &#8211;dry-run &#8211;debug<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: installs the tool, enables it and runs a test that changes nothing. You should see lines about allowed origins and, at the end, no errors. By default it applies security updates only and does not reboot the server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Where it does not fit: servers running a delicate application stack where an unplanned update could cause an outage. There, use automatic updates for the operating system but review application updates by hand.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Remove unnecessary packages and disable unused services<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Every running service is something to patch and defend. List what starts at boot:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">systemctl list-unit-files &#8211;state=enabled<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: shows services that are set to start automatically. Look for anything you did not choose, such as a second web server or a mail service you do not use.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To stop and disable one, and then remove its package:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo systemctl disable &#8211;now apache2<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo apt purge apache2<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo apt autoremove<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Replace apache2 with the service you want gone. Common mistake: removing something another program depends on. Read the list of packages apt plans to remove before you confirm. Keep a short note of what you removed and why.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Secure file permissions and ownership limit the damage<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Permissions decide who can read, change or run a file. A website should be readable by the web server and writable by almost nothing. For a site in \/var\/www\/example.com, a common safe pattern is:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo chown -R deploy:www-data \/var\/www\/example.com<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo find \/var\/www\/example.com -type d -exec chmod 755 {} \\;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo find \/var\/www\/example.com -type f -exec chmod 644 {} \\;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: gives the admin user ownership, lets the web server group read the files, sets directories to 755 and files to 644. Applications that must write, such as an uploads folder, need specific extra rights on just that folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Never fix a problem with chmod 777, which lets every user write. Find stray world writable files with this command:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo find \/var\/www -xdev -type f -perm -0002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Keep secrets such as .env files at 600 so only the owner can read them.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Fail2ban reduces repeated login attempts<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/github.com\/fail2ban\/fail2ban\" target=\"_blank\" rel=\"noopener\">Fail2ban<\/a> reads your logs and temporarily blocks addresses that fail to log in too many times. It reduces noise and slows brute force attempts. It does not replace strong authentication, so keep SSH keys as your real defense.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo apt install fail2ban<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo nano \/etc\/fail2ban\/jail.local<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add a small configuration, replacing YOUR_IP with your own address so you cannot ban yourself:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">[sshd]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">enabled = true<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">maxretry = 5<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">findtime = 10m<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bantime = 1h<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ignoreip = 127.0.0.1\/8 YOUR_IP<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo systemctl enable &#8211;now fail2ban<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo fail2ban-client status sshd<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: bans an address for an hour after five failures in ten minutes. The status command shows the jail is active and lists banned addresses. Common mistake: banning yourself with a typo. If it happens, unban yourself from the provider console:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo fail2ban-client set sshd unbanip YOUR_IP<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Do You Protect VPS Applications, Databases and Hosted Websites?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Harden the web server, keep the database private with its own limited user, turn on HTTPS, lock down Docker published ports and keep your CMS and plugins updated. The operating system can be perfect and a single old plugin will still be the way in.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Web server software needs a few safe defaults<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Apache and Nginx are safe when kept updated and configured with care. Three small settings help. Hide the version number, turn off directory listings and test every change before reloading.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Nginx, add this inside the http block of \/etc\/nginx\/nginx.conf, then test and reload:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">server_tokens off;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo nginx -t<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo systemctl reload nginx<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Apache, add these settings to your configuration, then test:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ServerTokens Prod<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ServerSignature Off<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Options -Indexes<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo apache2ctl configtest<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: stops the server announcing its version and refuses to list folder contents. You should see syntax is ok from the test commands. Common mistake: reloading without testing, which can take the site down on a typo.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Credentials and database access need strict limits<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run the database setup script first, then give each application its own limited user. Applications should never connect as the database root user.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo mysql_secure_installation<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">CREATE USER &#8216;appuser&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;a_long_unique_password&#8217;;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">GRANT SELECT, INSERT, UPDATE, DELETE ON appdb.* TO &#8216;appuser&#8217;@&#8217;localhost&#8217;;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: the script removes test data and tightens defaults. The SQL creates a user that can work with one database and nothing else, and only from the same server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Store application passwords in an environment file outside the web root, set it to 600 and keep it out of version control. Common mistake: committing a .env file to a public repository. Rotate any password that has ever been exposed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">HTTPS and SSL and TLS certificates protect data in transit<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">HTTPS encrypts traffic between visitors and your server, so passwords and form data cannot be read on the way. Certificates from Let&#8217;s Encrypt are free and renew automatically. Certbot is the usual tool on Ubuntu:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo snap install &#8211;classic certbot<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo certbot &#8211;nginx -d example.com -d www.example.com<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo certbot renew &#8211;dry-run<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: installs Certbot, gets a certificate and adjusts your Nginx configuration, then tests that renewal will work. You should see a success message on the dry run. Use the Apache option if that is your web server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Point your domain at the server before running it, or the request will fail. If you prefer paid certificates, see our <a href=\"https:\/\/skynethosting.net\/ssl-reseller-program.htm\">SSL reseller program<\/a>. A CDN such as <a href=\"https:\/\/skynethosting.net\/cloudflare.htm\">Cloudflare<\/a> can add another layer in front of your origin.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Docker containers and exposed application services need care<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Docker has a trap that surprises many new owners. Publishing a port with a plain mapping can bypass your UFW rules, so a service you thought was blocked is open. If you run tools such as n8n, as in our <a href=\"https:\/\/skynethosting.net\/blog\/install-self-hosted-n8n-vps-docker\/\">self hosted n8n guide<\/a>, check this first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Bind published ports to loopback and put a reverse proxy with HTTPS in front. In a Compose file that looks like this:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ports:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&#8211; &#8220;127.0.0.1:8080:80&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then see what is actually published:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">docker ps &#8211;format &#8216;table {{.Names}}\\t{{.Ports}}&#8217;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: lists each container and its ports. Anything starting with 0.0.0.0 is reachable from outside. Also avoid mounting the Docker socket into containers, and remember that membership in the docker group gives a user powers equal to root.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">CMS platforms, plugins and server applications must stay updated<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A hardened server still falls if a WordPress plugin is two years old. Update the core, themes and plugins on a schedule, and delete the ones you do not use. Our <a href=\"https:\/\/skynethosting.net\/blog\/wordpress-security-checklist-2027\/\">WordPress security checklist<\/a> covers the routine in more detail.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you manage WordPress from the command line, WP CLI makes it fast:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">wp core update<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">wp plugin update &#8211;all<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">wp plugin list &#8211;update=available<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: updates the core, updates all plugins and lists any still waiting. Take a backup before a big batch, and test important sites on a staging copy first. Updates can break a theme or plugin, and a backup is your way back.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Do You Monitor, Back Up and Maintain a Secure VPS?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Read your logs on a schedule, watch resource use for sudden changes, keep automated backups off the server and test restores. A secure server is not a finished server. It is one that you check regularly and can rebuild.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Server logs reveal suspicious login activity<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Logs record who tried to get in. Read the SSH log from the last day:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo journalctl -u ssh &#8211;since &#8220;24 hours ago&#8221; | tail -50<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">last -a | head<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo lastb | head<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: the first command shows recent SSH events. The second lists successful logins. The third lists failed ones. You should expect many failed attempts on a public server, and that is normal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What you should never see is a successful login from an address or time you do not recognize. If you do, treat it as a breach: change credentials, review accounts and restore from a clean backup if needed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">CPU, RAM, disk and network usage show unusual activity<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sudden resource spikes can mean a runaway process, a traffic surge or a hijacked server mining coins. Learn what normal looks like so odd stands out. Compare today&#8217;s numbers with last week&#8217;s, because a change matters more than any single reading.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">uptime<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">free -h<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">df -h<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sudo ss -s<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: these show load, memory, disk space and connection counts. A disk at 100 percent breaks databases and logging. A CPU pinned at 100 percent for hours deserves a look with the htop tool.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add an outside check too. A free uptime monitor that pings your site every few minutes tells you about trouble before a customer does.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Automated off server backups protect your important data<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A backup stored only on the VPS can be encrypted or deleted by the same attacker who gets in. Keep at least one copy elsewhere. Our NVMe VPS page lists weekly automated backups as included, with daily backups and snapshot storage as options, which is a good start. Confirm the current terms, and still keep your own copy in a different location, for example in another one of our <a href=\"https:\/\/skynethosting.net\/data-centers.htm\">data center regions<\/a> or with a separate provider.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A simple pair of commands covers a database and your site files. This example uses restic, a free backup tool, sending data to a remote storage location:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">mysqldump &#8211;single-transaction appdb | gzip &gt; \/backup\/appdb-$(date +%F).sql.gz<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">restic -r sftp:backupuser@backuphost:\/srv\/restic backup \/var\/www \/etc \/backup<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: the first command dumps the database to a dated file. The second encrypts and uploads your files. Schedule both from cron each night, for example at 2 a.m.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two cron details trip people up. Percent signs in a crontab must be escaped with a backslash, or the commands should live in a script. Keep the database login in a protected file such as ~\/.my.cnf, not on the command line. Where your storage supports it, use an append only mode so a hacked server cannot erase old snapshots.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Backup restoration must be tested before you need it<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A backup you never restored is a hope, not a backup. Test a restore on a schedule, ideally to a spare VPS or a temporary folder:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">restic -r sftp:backupuser@backuphost:\/srv\/restic snapshots<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">restic -r sftp:backupuser@backuphost:\/srv\/restic restore latest &#8211;target \/tmp\/restore-test<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What it does: the first command lists available snapshots with dates. The second restores the latest into a test folder. Check that files open and the database dump loads.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Time it. Suppose your data is 40 GB and your connection moves 100 megabits a second. Transfer alone takes about 53 minutes, before you rebuild anything. Know that number before an emergency, and write the recovery steps down.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">A recurring maintenance routine keeps the server secure<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Security is a habit. A weekly routine of about fifteen minutes catches most problems: install updates, check for a pending reboot, read failed logins and confirm the last backup ran. Monthly, list open ports and review users and keys.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each quarter, test a restore. Once a year, review everything against a benchmark.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you want a deeper checklist after this guide, the <a href=\"https:\/\/www.cisecurity.org\/cis-benchmarks\" target=\"_blank\" rel=\"noopener\">CIS Benchmarks<\/a> publish detailed settings for Ubuntu Linux. They are thorough, so treat them as the next step, not the first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Write down your emergency recovery procedure too: where credentials live, how to reach the provider console, how to restore a snapshot and who to call. Print the checklist below and tick it off after each new server.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>Done<\/strong><\/td><td><strong>Step<\/strong><\/td><td><strong>How to check it<\/strong><\/td><td><strong>Section<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>\u2610<\/strong><\/td><td>1. Create a non root admin account<\/td><td>id deploy shows the sudo group<\/td><td>SSH<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>2. Configure SSH key authentication<\/td><td>Key login works from a new session<\/td><td>SSH<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>3. Restrict direct root login<\/td><td>Sshd settings output shows root login off<\/td><td>SSH<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>4. Configure firewall rules<\/td><td>sudo ufw status verbose shows active<\/td><td>Firewall<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>5. Close unnecessary ports<\/td><td>Listening ports list shows only expected ports<\/td><td>Firewall<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>6. Install security updates<\/td><td>Upgradable package list is empty<\/td><td>Linux<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>7. Disable unnecessary services<\/td><td>Enabled services list holds only what you need<\/td><td>Linux<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>8. Configure login protection<\/td><td>Fail2ban status for the sshd jail shows active<\/td><td>Linux<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>9. Secure databases and credentials<\/td><td>Database on 127.0.0.1, .env at 600<\/td><td>Applications<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>10. Configure HTTPS<\/td><td>Certbot renewal dry run succeeds<\/td><td>Applications<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>11. Enable monitoring and log reviews<\/td><td>Weekly log check on the calendar<\/td><td>Monitoring<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>12. Automate off server backups<\/td><td>Nightly job runs and a copy exists elsewhere<\/td><td>Backups<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>13. Test backup restoration<\/td><td>Restored files open correctly<\/td><td>Backups<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>14. Review access permissions regularly<\/td><td>Users, keys and sudo list reviewed monthly<\/td><td>Maintenance<\/td><\/tr><tr><td><strong>\u2610<\/strong><\/td><td>15. Document emergency recovery<\/td><td>One page written and stored off the server<\/td><td>Maintenance<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Ready to put the checklist to work? Start with a clean Ubuntu install, follow the steps in order and keep a second terminal open. You can compare plans on our <a href=\"https:\/\/skynethosting.net\/vps.htm\">VPS hosting page<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Author name, role, years in hosting. Reviewed by Reviewer name, role. Last reviewed: November 15, 2026. VPS security basics come down to a short list: create a separate admin user, log in with SSH keys, turn on a firewall, install updates, protect your database and applications, and set up backups you have actually tested. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4659","post","type-post","status-publish","format-standard","hentry","category-skynethostinghappenings"],"blog_post_layout_featured_media_urls":{"thumbnail":"","full":""},"categories_names":{"1":{"name":"Skynethosting.net News","link":"https:\/\/skynethosting.net\/blog\/category\/skynethostinghappenings\/"}},"tags_names":[],"comments_number":"0","wpmagazine_modules_lite_featured_media_urls":{"thumbnail":"","cvmm-medium":"","cvmm-medium-plus":"","cvmm-portrait":"","cvmm-medium-square":"","cvmm-large":"","cvmm-small":"","full":""},"_links":{"self":[{"href":"https:\/\/skynethosting.net\/blog\/wp-json\/wp\/v2\/posts\/4659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skynethosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skynethosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skynethosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skynethosting.net\/blog\/wp-json\/wp\/v2\/comments?post=4659"}],"version-history":[{"count":1,"href":"https:\/\/skynethosting.net\/blog\/wp-json\/wp\/v2\/posts\/4659\/revisions"}],"predecessor-version":[{"id":4661,"href":"https:\/\/skynethosting.net\/blog\/wp-json\/wp\/v2\/posts\/4659\/revisions\/4661"}],"wp:attachment":[{"href":"https:\/\/skynethosting.net\/blog\/wp-json\/wp\/v2\/media?parent=4659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skynethosting.net\/blog\/wp-json\/wp\/v2\/categories?post=4659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skynethosting.net\/blog\/wp-json\/wp\/v2\/tags?post=4659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}