Salut !
J’ai configuré un accès SSH pour un serveur sur Internet. J’ai ré-installé mon poste client et maintenant, malgré que la clé est bien copiée dans $HOME/.ssh, le serveur me refuse l’accès.
Où est le problème ?
Salut !
J’ai configuré un accès SSH pour un serveur sur Internet. J’ai ré-installé mon poste client et maintenant, malgré que la clé est bien copiée dans $HOME/.ssh, le serveur me refuse l’accès.
Où est le problème ?
Salut,
Déjà, utilises-tu le bon utilisateur quand tu te connectes ?
Genre ssh ton_user@ta_machine, avec la clé dans /home/ton_user/.ssh/ ?
Et vérifie que dans ton fichier de conf (/etc/ssh/sshd_config), tu aies bien cette ligne :
Sinon, utilise l’option -vv de ssh, histoire d’avoir un peu de blabla pour te guider dans ce problème.
L’authentification fonctionnait très bien avec l’ancien utilisateur sur mon poste client, sans mot de passe, avec la clé SSH enregistrée par l’agent SSH avec sa phrase de passe.
J’ai créé un utilisateur sur le serveur. Voici la commande que j’utilise :
Voici un extrait du retour du serveur :
debug1: Host '[<mon-serveur.domaine.dns>]:<port>' is known and matches the RSA host key.
debug1: Found key in /home/<utilisateur-client>/.ssh/known_hosts:1
debug2: bits set: 491/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: .ssh/<ma-clé> (0x7fa86be04540)
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: .ssh/<ma-clé>
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
As-tu bien copié la clé dans le fichier ~/.ssh/authorized_keys ?
Le paramètre AuthorizedKeysFile du fichier de conf est bien %h/.ssh/authorized_keys ou ~/.ssh/authorized_keys ?
Quels sont les droits (et owner) du répertoire .ssh et des fichiers qui s’y trouvent ?
Sinon, regarde sur le serveur le fichier /var/log/auth.log voir s’il dit des trucs intéressants.
Je suis dans la situation où je n’ai pas accès depuis un poste client à un serveur sur lequel je dois m’identifier grâce à une clé SSH. J’ai l’impression que tu me poses des questions comme si je cherchais à configurer un accès SSH sur le serveur, je me trompe ?
Le fichier authorized_keys, c’est pour le serveur. Et je n’y ai pas accès … :smt003
J’ai ma clé dans mon porte-clés sur mon poste client mais le serveur la refuse. Je suis plus clair, là ?
Je suis absolument sûr que c’est la bonne clé …
Bsr,
J’ai eu le même problème avec rsa. Il faut générer la clé avec dsa
Et si le serveur n’est pas chez toi, ça va être chaud. Tu n’as pas un autre lien avec, du genre nfs ou samba ?
S’il faut ré-installer, je le ferai mais je veux comprendre pourquoi cela ne fonctionne pas … C’est la troisième fois que cela m’arrive et les deux premières fois je pensais avoir fait une erreur ! Il doit y avoir une information autre que la clé qui est stockée.
ssh -vvv
(3 c’est le maximum)
Après avoir démarré l’agent, le ssh-add marche?
OpenSSH_5.1p1 Debian-5+b1, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to #### DNS SERVEUR #### [#### IP SERVEUR ####] port #### PORT SERVEUR ####.
debug1: Connection established.
debug3: Not a RSA1 key file /home/<utilisateur_client>/.ssh/<clé_ssh>.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'Proc-Type:'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'DEK-Info:'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/<utilisateur_client>/.ssh/<clé_ssh> type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5+b1
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 134/256
debug2: bits set: 485/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: put_host_port: [#### IP SERVEUR ####]:#### PORT SERVEUR ####
debug3: put_host_port: [#### DNS SERVEUR ####]:#### PORT SERVEUR ####
debug3: check_host_in_hostfile: filename /home/<utilisateur_client>/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: filename /home/<utilisateur_client>/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug1: checking without port identifier
debug3: check_host_in_hostfile: filename /home/<utilisateur_client>/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: filename /home/<utilisateur_client>/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: filename /home/<utilisateur_client>/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug2: no key of type 0 for host [[#### DNS SERVEUR ####]]:#### PORT SERVEUR ####
debug3: check_host_in_hostfile: filename /home/<utilisateur_client>/.ssh/known_hosts2
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts2
debug3: check_host_in_hostfile: filename /home/<utilisateur_client>/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug2: no key of type 2 for host [#### DNS SERVEUR ####]:#### PORT SERVEUR ####
The authenticity of host '[#### DNS SERVEUR ####]:#### PORT SERVEUR #### ([#### IP SERVEUR ####]:#### PORT SERVEUR ####)' can't be established.
RSA key fingerprint is c0:07:56:6e:b3:30:ba:1a:20:f2:03:c1:91:20:44:ef.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[#### DNS SERVEUR ####]:#### PORT SERVEUR ####,[#### IP SERVEUR ####]:#### PORT SERVEUR ####' (RSA) to the list of known hosts.
debug2: bits set: 503/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/<utilisateur_client>/.ssh/<clé_ssh> (0x7faf8d4b3510)
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred gssapi-keyex,gssapi-with-mic,gssapi,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/<utilisateur_client>/.ssh/<clé_ssh>
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
Qu’est ce que tu entends par “ssh-add marche” ?
Mauvais utilisateur : problème réglé.