The default in RHEL7 and lower was to permit root. From RHEL8 and higher, the default is either without-password or prohibit-password. However, this was no different to a lot of the other distros out there. At one point in time Debian as well as Ubuntu also had similar configuration before using one of the other methods. Some defaulted to the without one, and some to prohibit.
The newer two options allow you to put an SSH key under /root/.ssh/authorized_keys and you can then directly connect to the server via ssh as root. It just won’t allow password access. Otherwise, set permitroot to no to completely disable it, for ssh keys as well.
without-password is synonym for prohibit-password. Older openssh had only the former. The latter sounds more intuitive, while both mean that root cannot login with password.
On installer of EL9 there is an opt-in checkbox, which – if selected – adds a file with PermitRootLogin yes to override the default PermitRootLogin prohibit-password. (On EL9 there is directory /etc/ssh/sshd_config.d/ where one can drop in customizations. The EL8 has a dir only for client customizations: /etc/ssh/ssh_config.d/ )
Do you ssh to your workstation, ever? If not, then you could disable the sshd.service. No process, no vulnerability.
@jlehtone
Thanks once again for taking the time to help out.
You are correct, I dont ssh to my workstation
And a couple of months ago I tried to do as much as possible to secure my machine eg disallowing ssh access. I should have mentioned this in the first place.
At the time I had learned to do and did the following:
I had set “PermitRootLogin no” in sshd_config.
I had also disabled the sshd service.
Do you ssh to your workstation, ever? If not, then you could disable the sshd.service. No process, no vulnerability.
Thanks for confirming it is best to disable the sshd.service. No process, no vulnerability.
I don’t know “rkhunter” nor what it actually checks.
Yes. Some packages set service enabled, when you install it. Others have the “disabled” preset and you have to explicitly enable such service. The sshd is enabled by default, but you have properly disabled it.
I don’t know “rkhunter” nor what it actually checks.
Fair enough I don’t mean to get support on rkhunter here on the Rocky Linux forum. I was just more concerned if I still have ssh root access allowed and you helped me with that.
Thanks for explaining what vendor preset means.
For anyone who finds this post searching for rkunter, I came across rkhunter from this article:
A very belated thanks to wintpe - I somehow missed seeing your post until now - I have removed port 22.
The way I did it is using firewall-config > Services > ssh > Ports > Remove port 22 from list