Hi all. Fairly new here. Just setting up Ubuntu Server 24.04 on old HP Desktop.
Trying to disable ssh root login.
-Have been editing “/etc/ssh/sshd_config” file. Have tried setting “PermitRootLogin no” and “PermitRootLogin prohibit-password”, but can still log in as root remotely using ssh.
-There is one file in “/etc/ssh/sshd_config.d/50-cloud-init.conf” and have put an # before “PasswordAuthentication yes” to nullify.
-Have changed “Port 2021” in “/etc/ssh/sshd_config” and it has taken effect Confirming that this file is being used/loaded.
-Have noted that there are many versions of “sshd_config”
/usr/share/openssh/sshd_config (this one has #PermitRootLogin and nothing else suspicious)
/etc/ssh/sshd_config (this is the one I edit)
/snap/core22/2139/etc/ssh/sshd_config (this is immutable)
/snap/core22/2139/usr/share/openssh/sshd_config (this is immutable)
I have restarted ssh and rebooted the server numerous times after the changes.
Current status using: systemctl status ssh.service
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/usr/lib/systemd/system/ssh.service; disabled; preset: enabled)
Active: active (running) since Mon 2025-11-17 14:18:39 UTC; 17s ago
TriggeredBy: ● ssh.socket
Docs: man:sshd(8)
man:sshd_config(5)
Process: 2146 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 2149 (sshd)
Tasks: 1 (limit: 7003)
Memory: 1.2M (peak: 1.3M)
CPU: 48ms
CGroup: /system.slice/ssh.service
└─2149 “sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups”
I’m a little curious about what “man:sshd_config(5)” means in this status report. Does it mean 5 files were used/loaded?
Anyway, my goal is to disable Root User access via ssh - as is recommended for security purposes. I have created another sudo user, also as recommended, and which works fine.
Any suggestions?
Thanks, Jim.