Changed SSH port and disallow passwords/require key and disallow root login, but still can do all?

I changed the SSH port in webmin to a different one from default, disallowed authentication by password, and have a key in authorized_keys, and disallowed root login. However,
port 22 still works (new port doesnt)
can log in with just password
root can still ssh

What am I doing wrong here?

SYSTEM INFORMATION
OS type and version AlmaLinux 8.7
Webmin version 2.010

You have to open the port in the firewall. For example, assuming firewalld and a new SSH port of 1234:

firewall-cmd --permanent --zone=public --add-port=1234/tcp

and also in selinux if enabled

semanage port -a -t ssh_port_t -p tcp 1234

reload the firewall

firewall-cmd --reload

and restart sshd to load the new config

systemctl restart sshd

Richard

EDIT: I don’t know if AlmaLinux ships with semanage. If not, then

dnf install policycoreutils-python-utils

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.