Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 1.2 KB

File metadata and controls

41 lines (27 loc) · 1.2 KB

🔐 SSH Port Changer Script

Easily and safely change your SSH port on any Linux VPS or dedicated server. This script supports Ubuntu, Debian, CentOS, and AlmaLinux, and also handles firewall rules and SELinux policies automatically.

⚠️ Disclaimer

Changing your SSH port may lock you out of your server if not done properly. Please ensure you have VNC, IPMI, or console access before using this script.

✅ Supported Systems

  • Ubuntu 20.04 / 22.04
  • Debian 11 and above
  • CentOS 7 / 8
  • AlmaLinux 8 / 9

🧰 Features

  • Prompts until valid SSH port is entered
  • Updates sshd_config with new port
  • Opens the new port via:
    • UFW (Ubuntu/Debian)
    • Firewalld or iptables (CentOS/AlmaLinux)
  • Automatically handles SELinux context updates
  • Restarts SSH service without needing reboot

📥 How to Use

wget https://raw.githubusercontent.com/hosteons/ssh-port-changer/main/ssh_port_changer.sh
chmod +x ssh_port_changer.sh
sudo ./ssh_port_changer.sh

📝 License

MIT License — Free to use, modify, and share.

🔗 About Hosteons

This tool is created by Hosteons.com, a trusted provider of KVM VPS, VDS, and dedicated servers across the US and EU.