Skip to content

Change SSH port safely on Ubuntu, Debian, CentOS, and AlmaLinux. Handles firewall rules and SELinux automatically. Secure and cross-distro compatible.

License

Notifications You must be signed in to change notification settings

hosteons/SSH-Port-Changer-Script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” 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.

About

Change SSH port safely on Ubuntu, Debian, CentOS, and AlmaLinux. Handles firewall rules and SELinux automatically. Secure and cross-distro compatible.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages