Business inquiries

[email protected]

Sales department

@bithosting_sales

Technical support

@bithosting_tech

🛡 How to Protect VPS from Hacking and Brute Force

Securing your VPS is critical. Below are the essential steps to protect your server from brute-force attacks and unauthorized access. These recommendations are suitable for both beginners and experienced administrators.

🔐 1. Disable Root Login via SSH

This reduces the risk of brute-force attacks on the root account.

sudo nano /etc/ssh/sshd_config
# Find the line
PermitRootLogin yes
# Change to
PermitRootLogin no

# Then restart SSH
sudo systemctl restart ssh
    

🔁 2. Change Default SSH Port

Most brute-force bots target port 22. Changing it helps avoid automated attacks.

sudo nano /etc/ssh/sshd_config
# Change Port 22 to something else:
Port 2222

sudo ufw allow 2222
sudo systemctl restart ssh
    

🧱 3. Install and Configure Fail2Ban

Fail2Ban blocks IP addresses showing suspicious behavior (e.g., repeated failed logins).

sudo apt install fail2ban -y
sudo systemctl enable fail2ban --now
    

For basic setup, edit the following file:

sudo nano /etc/fail2ban/jail.local
    

🔑 4. Use SSH Key Authentication

Generate and upload your SSH key to the server:

ssh-keygen
ssh-copy-id user@your-server-ip
    

🔒 5. Configure UFW Firewall

Limit open ports to essential services only:

sudo ufw allow 2222/tcp
sudo ufw allow 80,443/tcp
sudo ufw enable
    

📌 Other Tips

← Back to Security section

If you need help securing your VPS — contact Bit.Hosting support. We'll help you set up protection!

BIT.HOSTING

Your path to perfection

Maximum Performance

Stable servers and modern hardware ensure fast and reliable operation of your services.

Ultimate Configuration Flexibility

Support for various OS and control panels lets you tailor your hosting environment to your exact needs.

Affordable Server Prices

We offer some of the most competitive and accessible prices on the market.

24/7 Customer Support

Our experts are here to assist you anytime — with advice, solutions, or technical help around the clock.