1

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.

3
  • Are the servers the same distro and (major) version? I've run into an issue with incompatible crypto policies and/or cipher suites. Unfortunately, I don't remember the details.
    – Bron
    Commented Jan 5, 2023 at 19:14
  • Does your sshd.config have 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 it
    – Cpt.Whale
    Commented Jan 5, 2023 at 19:48
  • 1
    Does journalctl -u sshd give any additional error messages that are helpful?
    – doneal24
    Commented Jan 5, 2023 at 20:55

1 Answer 1

0

I found out we have a third party software that has yet ANOTHER sshd_config file that needs to be modified to allow root login. Thanks for the help!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .