How to Secure Proxmox SSH: 5 Critical Steps
A guide to changing the SSH port, using key-based login and configuring Fail2ban to stop root brute-force attacks on Proxmox servers.
As soon as you expose your Proxmox server to the internet, check the /var/log/auth.log file. You will see hundreds of IPs from China, Russia or anywhere else in the world making dozens of attempts per second to guess your root password.
You won't survive long on the internet with the default port 22 and a simple password. These five steps help secure SSH access to Proxmox.
1. Change SSH Port
Automated scans of the default port are common; do not quote a rate without measured data. Changing the port alone does not provide complete security, but it may reduce some automatic scanning; it is not a substitute for access control and strong authentication.
Open /etc/ssh/sshd_config:
Find the line that says Port 22 and replace it with a free port above 1024, for example Port 4822.
Make sure you allow this new port through the Proxmox firewall before restarting the service!
2. Disable Password Login and Use SSH Keys
Passwords can be guessed, stolen or cracked by brute force. Suitable SSH keys provide strong authentication; also manage the risk of key, device or account recovery path compromise.
Generate your key with ssh-keygen on your own computer, then add your public key to Proxmox's ~/.ssh/authorized_keys file.
After testing that you are logged in with the key, add the following line to the sshd_config file:
PasswordAuthentication no
Password authentication can be turned off with this setting; also check for other active authentication methods and existing sessions.
3. Limit Direct Root Login
Instead of logging into the server directly with the user root, create a regular user with sudo privileges. Do your daily work with this user. If necessary, allow root to log in only with an SSH key by setting PermitRootLogin prohibit-password.
4. Install Fail2ban
To automatically ban IP addresses that make 3-5 incorrect attempts in a row for 24 hours, install Fail2ban on the server:
apt install fail2ban -y
You can instantly disable aggressive scanning bots with a simple jail rule.
5. Two-Factor Authentication (2FA / TOTP)
For the Proxmox web panel, be sure to activate 2FA with Google Authenticator or YubiKey. Even if your password is compromised, a second authentication factor is required; recovery codes, sessions and the security of the chosen method must be managed separately.
Resources and related guides
- OpenSSH: sshd_config authentication and access options
- Firewall access for SSH and management ports
- Passkey, session and recovery flows
Check account access outside of SSH
After configuring SSH access, also review team accounts and sessions in the administration panel. You can find the relevant checklist in the cloud account security and passkey guide.