Setting up SSH keys for root (technically ed25519 keys). Created the key pair on server I want to logon FROM and put the pub key onto the authorized key file of the server I want to connect TO.
I can login with ssh keys with my user(regular user), but not as the root user.
File permissions:
[root@MyTargetServer .ssh]# ls -hal
total 16K
drwx------. 2 root root 75 Jan 4 23:52 .
dr-xr-x---. 4 root root 4.0K Oct 20 14:22 ..
-rw-r--r--. 1 root root 1.2K Jan 4 23:52 authorized_keys
-rw-r--r--. 1 root root 171 Oct 20 14:22 known_hosts
I made sure I modified the /etc/ssh/sshd_config to contain:
PermitRootLogin yes
I tried to restart the service and wondering if that's the issue?
sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2023-01-05 00:06:14 EST; 28s ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 14165 ExecStart=/usr/sbin/sshd -D $OPTIONS $CRYPTO_POLICY (code=exited, status=255)
Main PID: 14165 (code=exited, status=255)
Jan 05 00:06:14 MyTargetServer systemd[1]: sshd.service: Main process exited, code=exited, status=255/n/a
Jan 05 00:06:14 MyTargetServer systemd[1]: sshd.service: Failed with result 'exit-code'.
Jan 05 00:06:14 MyTargetServer systemd[1]: Failed to start OpenSSH server daemon.
However - I am still ssh'ed into the machine while I'm doing all this, and I can login with ssh keys using that normal user. So I THINK the problem is that I can't ssh in as root.
I have gotten this to work with other servers, but not finding the delta between those and these new ones.
AllowUsers
set? It does look like the SSH server service was still starting based on that output. Check verbose output from your SSH client to see if the server rejected root's key or just choked on itjournalctl -u sshd
give any additional error messages that are helpful?