I have a small question regarding SSH
How do I change the port for ssh and allow the new port in firewalld. How do I then close the old port 22 in firewalld?
Kind regards
I have a small question regarding SSH
How do I change the port for ssh and allow the new port in firewalld. How do I then close the old port 22 in firewalld?
Kind regards
firewall-cmd
or with files in /etc/firewalld/*
. See Configuring firewalls and packet filters Red Hat Enterprise Linux 9 | Red Hat Customer Portal
How to configure SSH to use a non-standard port with SELinux set to enforcing | TechRepublic is another one that gives instructions for the ssh port and firewall.
That says sudo nano /etc/ssh/sshd_config
Fine for el8, but el9 has a new shiny:
sudo nano /etc/ssh/sshd_config.d/00-myport.conf
The statements in /etc/ssh/sshd_config.d/00-myport.conf
do override statements
in /etc/ssh/sshd_config
and you can later easily see what customizations you
have done, rather than asking “What did I edit in /etc/ssh/sshd_config
?”
Ah, thanks for that. As the one Alma I’m using regularly is on an older machine that won’t take Alma9, I wasn’t aware of that. (My other installs are on laptops or vms, where I haven’t tried to change the default port). So, I learned something this morning, thanks to you.