Skip to main content
This script applies to VPS and Bare Metal servers. Make sure you have an SSH key pair configured before running this script — it will disable password authentication.

Before You Start

Generate an SSH Key Pair

If you don’t already have an SSH key, generate one on your local machine (not the server):

Copy Your Public Key to the Server

Verify you can log in with your key before proceeding:
If you run this script without a working SSH key on the server, you will be locked out. Verify key-based login works before proceeding. If you do get locked out, use the VirtFusion console (VPS) or IPMI (Bare Metal) to recover access.

The Script

Usage

Edit the configuration variables at the top of the script before running:
Then run:

If You Change the SSH Port

If you change the port, update your firewall before disconnecting:
Then connect using the new port:

Verifying Fail2Ban

What the Script Changes