Preciso ativar temporariamente o SSH root em uma estação de trabalho Fedora 40 com chave. Os logs do cliente SSH confirmam que a chave adequada foi enviada e aceita (copiada abaixo). sshd
os logs de depuração (também abaixo) mostram o mesmo, mas de alguma forma ROOT LOGIN REFUSED FROM ...
ainda estão acontecendo.
Coisas que fiz:
- Em
/etc/ssh/sshd_config
:PermitRootLogin yes
+AllowUsers root ...
DenyUsers|DenyGroups
no mesmo arquivo não definido.- usuário root não bloqueado conforme
sudo passwd -S root
, também com um shell válido. - definido
sudo setenforce 0
provisoriamente para descartar o SELinux. ls -l /root/.ssh/authorized_keys
(e diretório pai) confirma as permissões adequadas (600.700) - (usandoStrictModes no
apenas por precaução, de qualquer maneira)/etc/security/access.conf
não mostra restrições para root (todas as linhas comentadas)- Nenhuma configuração personalizada foi adicionada em
cat /etc/pam.d/
Registros do cliente:
ssh -v -t -o IdentitiesOnly=yes -o PreferredAuthentications=publickey [email protected]
...
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Will attempt key: /Users/.../.ssh/id_ed25519 ED25519 SHA256:4ZMC... explicit agent
debug1: Offering public key: /Users/.../.ssh/id_ed25519 ED25519...
debug1: Server accepts key: /Users/.../.ssh/id_ed25519 ED25519...
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Registros do servidor:
Jul 25 08:37:05 n1 sshd[110058]: debug1: PAM: initializing for "root"
Jul 25 08:37:05 n1 sshd[110058]: debug1: PAM: setting PAM_RHOST to "192.168.1.23"
Jul 25 08:37:05 n1 sshd[110058]: debug1: PAM: setting PAM_TTY to "ssh"
Jul 25 08:37:05 n1 sshd[110058]: debug1: userauth-request for user root service ssh-connection method publickey [preauth]
Jul 25 08:37:05 n1 sshd[110058]: debug1: attempt 1 failures 0 [preauth]
Jul 25 08:37:05 n1 sshd[110058]: debug1: userauth_pubkey: publickey test pkalg ssh-ed25519 pkblob ED25519 SHA256:4ZMC4... [preauth]
Jul 25 08:37:05 n1 sshd[110058]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Jul 25 08:37:05 n1 sshd[110058]: debug1: trying public key file /root/.ssh/authorized_keys
Jul 25 08:37:05 n1 sshd[110058]: debug1: fd 5 clearing O_NONBLOCK
Jul 25 08:37:05 n1 sshd[110058]: debug1: /root/.ssh/authorized_keys:1: matching key found: ED25519 SHA256:4ZMC4....
Jul 25 08:37:05 n1 sshd[110058]: debug1: /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
Jul 25 08:37:05 n1 sshd[110058]: Accepted key ED25519 SHA256:4ZMC4.... found at /root/.ssh/authorized_keys:1
Jul 25 08:37:05 n1 sshd[110058]: debug1: restore_uid: 0/0
Jul 25 08:37:05 n1 sshd[110058]: Postponed publickey for root from 192.168.1.23 port 50995 ssh2 [preauth]
Jul 25 08:37:05 n1 sshd[110058]: debug1: userauth-request for user root service ssh-connection method [email protected] [preauth]
Jul 25 08:37:05 n1 sshd[110058]: debug1: attempt 2 failures 0 [preauth]
Jul 25 08:37:05 n1 sshd[110058]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Jul 25 08:37:05 n1 sshd[110058]: debug1: trying public key file /root/.ssh/authorized_keys
Jul 25 08:37:05 n1 sshd[110058]: debug1: fd 5 clearing O_NONBLOCK
Jul 25 08:37:05 n1 sshd[110058]: debug1: /root/.ssh/authorized_keys:1: matching key found: ED25519 SHA256:4ZMC4j....
Jul 25 08:37:05 n1 sshd[110058]: debug1: /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
Jul 25 08:37:05 n1 sshd[110058]: Accepted key ED25519 SHA256:4ZMC4jv... found at /root/.ssh/authorized_keys:1
Jul 25 08:37:05 n1 sshd[110058]: debug1: restore_uid: 0/0
Jul 25 08:37:05 n1 sshd[110058]: debug1: auth_activate_options: setting new authentication options
Jul 25 08:37:05 n1 sshd[110058]: ROOT LOGIN REFUSED FROM 192.168.1.23 port 50995
Jul 25 08:37:05 n1 sshd[110058]: Failed publickey for root from 192.168.1.23 port 50995 ssh2: ED25519 SHA256:4ZMC4jv....
Jul 25 08:37:05 n1 sshd[110058]: debug1: auth_activate_options: setting new authentication options [preauth]
Jul 25 08:37:05 n1 sshd[110058]: ROOT LOGIN REFUSED FROM 192.168.1.23 port 50995 [preauth]
Jul 25 08:37:05 n1 sshd[110058]: Connection closed by authenticating user root 192.168.1.23 port 50995 [preauth]
Também:
cat /etc/securetty
ssh
pts/0
pts/1
pts/2
pts/3