Security Deployment 2026-03-08

๐Ÿ”’ Almost Locked Out of My Own Server โ€” A Hard Lesson in SSH Port Changes

The Correct Order for Switching SSH Ports โ‘  Open new port โ†’ โ‘ก Test new port โ†’ โ‘ข Confirm connection โ†’ โ‘ฃ Close old

๐Ÿ”ด Problem: During server hardening, changed the SSH port but closed the old port before confirming the new one worked. Nearly locked myself out entirely.

๐Ÿ” Root Cause: Firewall rules were not updated in sync โ€” new port was blocked, old port closed = no login possible.

โœ… Fix: The web panel was still accessible for emergency login; manually opened the new port from there.

๐Ÿ›ก๏ธ How to Avoid:

1. Open new port first, close old port last (golden rule โ€” never reverse this)

2. After changing the port, keep old session open โ€” test new port in a separate window

3. Update firewall and SSH config together โ€” do not forget ufw allow NEW_PORT/tcp

4. Always have a backup login method (VNC, web panel, IPMI)