Bonjour,
J'ai un soucis de config avec ssh qui je pense est un grand classique : pouvoir se connecter en ssh sans avoir la demande de mot de passe.
J'ai 2 machines, la "dagda" est le client et "andarta" le serveur.
Sur andarta j'ai sshd donc voici la config (jai mis les lignes non commentées seulement) :
AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
KbdInteractiveAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
Sur dagda j'ai créé ma clé comme ceci avec un password :
Je l'ai ensuite envoyée sur andarta :
ssh-copy-id -i ~/.ssh/id_ed25519_andarta.pub stephane@192.168.1.101
Si je test une connexion, le password est toujours demandé.
Droits des fichiers sur dagda :
-> dossier .ssh :
drwx------ - stephane 22 févr. 11:58 .ssh
-> clés :
.rw------- 464 stephane 22 févr. 11:52 id_ed25519_andarta
.rw-r--r-- 96 stephane 22 févr. 11:54 id_ed25519_andarta.pub
Droits des fichiers sur andarta :
-> dossier .ssh :
drwx------ 2 stephane stephane 4096 22 févr. 11:53 .ssh
-rw------- 1 stephane stephane 96 22 févr. 11:53 authorized_keys
Le contenu de authorized_keys est identique a ce qui se trouve dans id_ed25519_andarta.pub
Sur dagda j'ai rajouté ceci dans .ssh/config :
Host "Andarta"
HostName 192.168.1.101
User stephane
IdentityFile /home/stephane/.ssh/id_ed25519_andarta
Si je tente une connexion comme ceci le password est aussi demandé :
ssh stephane@192.168.1.101 -i ~/.ssh/id_ed25519_andarta
Logs :
ssh stephane@192.168.1.101 -v
OpenSSH_8.4p1 Debian-5+deb11u3, OpenSSL 1.1.1w 11 Sep 2023
debug1: Reading configuration data /home/stephane/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 192.168.1.101 [192.168.1.101] port 22.
debug1: Connection established.
debug1: identity file /home/stephane/.ssh/id_rsa type 0
debug1: identity file /home/stephane/.ssh/id_rsa-cert type -1
debug1: identity file /home/stephane/.ssh/id_dsa type -1
debug1: identity file /home/stephane/.ssh/id_dsa-cert type -1
debug1: identity file /home/stephane/.ssh/id_ecdsa type -1
debug1: identity file /home/stephane/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/stephane/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/stephane/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/stephane/.ssh/id_ed25519 type -1
debug1: identity file /home/stephane/.ssh/id_ed25519-cert type -1
debug1: identity file /home/stephane/.ssh/id_ed25519_sk type -1
debug1: identity file /home/stephane/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/stephane/.ssh/id_xmss type -1
debug1: identity file /home/stephane/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u3
debug1: Remote protocol version 2.0, remote software version OpenSSH_9.2p1 Debian-2+deb12u2
debug1: match: OpenSSH_9.2p1 Debian-2+deb12u2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.101:22 as 'stephane'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:qudiHwkdaJ4ALP6hsWi2vmz7Un3OodcHPNe44ZPeNdI
debug1: Host '192.168.1.101' is known and matches the ECDSA host key.
debug1: Found key in /home/stephane/.ssh/known_hosts:93
debug1: ssh_packet_send2_wrapped: resetting send seqnr 3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: ssh_packet_read_poll2: resetting read seqnr 3
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/stephane/.ssh/id_rsa RSA SHA256:VXB/sa1lknV7NzhUhhLEYtSVLt8/N+jHWD+1J6aYZ7U
debug1: Will attempt key: /home/stephane/.ssh/id_dsa
debug1: Will attempt key: /home/stephane/.ssh/id_ecdsa
debug1: Will attempt key: /home/stephane/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/stephane/.ssh/id_ed25519
debug1: Will attempt key: /home/stephane/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/stephane/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com,ssh-dss,ssh-rsa,rsa-sha2-256,rsa-sha2-512>
debug1: kex_input_ext_info: publickey-hostbound@openssh.com (unrecognised)
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/stephane/.ssh/id_rsa RSA SHA256:VXB/sa1lknV7NzhUhhLEYtSVLt8/N+jHWD+1J6aYZ7U
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/stephane/.ssh/id_dsa
debug1: Trying private key: /home/stephane/.ssh/id_ecdsa
debug1: Trying private key: /home/stephane/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/stephane/.ssh/id_ed25519
debug1: Trying private key: /home/stephane/.ssh/id_ed25519_sk
debug1: Trying private key: /home/stephane/.ssh/id_xmss
debug1: Next authentication method: password
stephane@192.168.1.101's password:
Une idée de ce qui peut bloquer ?
Merci d'avance