Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 18/07/2007, à 19:20

benzoid555

Serveur SSH : Permission denied (publickey).

Bonjour,

Je suis en train d'installer un serveur ssh (Open-SSH) pour utiliser un programme en local (code-aster).

mais il mets impossible de me connecter a mon serveur ssh

le serveur ssh a l'air de tourner :

benzoid555@ubuntu:~$ ps aux | grep ssh
1000      4851  0.0  0.1   4480   768 ?        Ss   16:50   0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session x-session-manager
root      6718  0.0  0.2   4936  1068 ?        Ss   18:28   0:00 /usr/sbin/sshd
1000     10733  0.0  0.1   2828   744 pts/0    D+   19:05   0:00 grep ssh

j'ai crée un clé public :

benzoid555@ubuntu:~$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/benzoid555/.ssh/id_dsa): 
/home/benzoid555/.ssh/id_dsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/benzoid555/.ssh/id_dsa.
Your public key has been saved in /home/benzoid555/.ssh/id_dsa.pub.
The key fingerprint is:
0e:5f:a1:6f:a4:b9:66:3a:f9:d3:d9:2b:19:5e:76:7b benzoid555@ubuntu

j'ai suprimer le mot de passe (pour simplifier la recherche d'erreur) dans /etc/ssh/sshd_conig

# Package generated configuration file
# See the sshd(8) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords yes

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

UsePAM yes

et voici le resultat :

OpenSSH_4.3p2 Debian-5ubuntu1, OpenSSL 0.9.8b 04 May 2006
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to ubuntu [192.168.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/benzoid555/.ssh/identity type -1
debug1: identity file /home/benzoid555/.ssh/id_rsa type -1
debug1: identity file /home/benzoid555/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-5ubuntu1
debug1: match: OpenSSH_4.3p2 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3p2 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
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
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ubuntu' is known and matches the RSA host key.
debug1: Found key in /home/benzoid555/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/benzoid555/.ssh/identity
debug1: Trying private key: /home/benzoid555/.ssh/id_rsa
debug1: Offering public key: /home/benzoid555/.ssh/id_dsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

ou encore

benzoid555@ubuntu:~$ ssh -v benzoid555@127.0.0.1
OpenSSH_4.3p2 Debian-5ubuntu1, OpenSSL 0.9.8b 04 May 2006
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/benzoid555/.ssh/identity type -1
debug1: identity file /home/benzoid555/.ssh/id_rsa type -1
debug1: identity file /home/benzoid555/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-5ubuntu1
debug1: match: OpenSSH_4.3p2 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3p2 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
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
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '127.0.0.1' is known and matches the RSA host key.
debug1: Found key in /home/benzoid555/.ssh/known_hosts:3
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/benzoid555/.ssh/identity
debug1: Trying private key: /home/benzoid555/.ssh/id_rsa
debug1: Offering public key: /home/benzoid555/.ssh/id_dsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

nota j'ai fais les essais avec le firewall temporairement arreter

si vous avez une idée sur ce qui cloche ?

merci d'avance


http://haefflerbenoit.free.Fr

Hors ligne

#2 Le 18/07/2007, à 21:04

Mmaathieu

Re : Serveur SSH : Permission denied (publickey).

as tu copié la clé du client sur le serveur ? il faut utiliser la commande ssh-copy-id il me semble


Athlon II X3 450
NVidia GT218
4Go DDR3

Hors ligne

#3 Le 19/07/2007, à 22:11

Uggy

Re : Serveur SSH : Permission denied (publickey).

"man ssh"
The file ~/.ssh/authorized_keys lists the public keys that are permitted for logging in.

Hors ligne

#4 Le 21/06/2009, à 21:41

sebastien01

Re : Serveur SSH : Permission denied (publickey).

Bonjour à tous.

Aprés 2 jours de galére à avoir le message permission denied publickey, j'ai trouvé la solution big_smile

Je vien la poser ici car je ne l'ai trouvé null par sur le web. Biensur cette solution n'est  applicable aprés avoir fais tout se qui est dit dans l'article SSH de ubuntu

http://doc.ubuntu-fr.org/ssh

Voici la solution :

il faut être coté serveur allé dans le fichier /etc/ssh/sshd_config à la ligne 31

vous aurez ca :

AuthorizedKeysFile    %h/.ssh/authorized_keys

il faut remplacer le %h par ~ ou /home/Votre_Identifiant se qui donne


AuthorizedKeysFile ~/.ssh/authorized_keys

ou


AuthorizedKeysFile    /home/Votre_Identifiant/.ssh/authorized_keys

Voila réssaye de vous connecté et la votre passe phrase seras demandé cool

#5 Le 03/06/2010, à 11:50

deathux

Re : Serveur SSH : Permission denied (publickey).

Salut je viens de faire la meme modif que toi, mais j'ai toujours pas l'autorisation... je pige pas...

Hors ligne

#6 Le 20/12/2010, à 11:24

julien_a

Re : Serveur SSH : Permission denied (publickey).

Bonjour,

Je rencontre ce même problème.

J'ai deux machines en réseau local :
- une machine "server" (Athlon XP2600+) sous Ubuntu 10.10 desktop edition 32bits,
- un netbook "client" (Atom N550) sous Ubuntu 10.10 64bits desktop edition transformée en netbook edition.

J'ai installé un serveur ssh sur la machine "server" et ai suivi toutes les étapes présentées dans la page ssh de la doc ubuntu (http://doc.ubuntu-fr.org/ssh), ainsi que de l'article référencé (http://technique.arscenic.org/connexion … sh-poussee).

Je rencontre ce même bug : après avoir créé les clés "client", copié la clé publique sur le "server", et supprimé l'authentification par mot de passe, je me fais jeter par un :

Permission denied (publickey).

J'ai essayé les solutions proposées :
- le remplacement de "%h" par "/home/[user]" ou "~/" dans le sshd_config du serveur,
- taper "SSH_AUTH_SOCK=0 ssh server" pour se connecter.

Et rien ne marche. C'est d'autant plus bluffant que "SSH_AUTH_SOCK=0 ssh server" a l'air de fonctionner pour pas mal de monde.

J'ai fouillé le fil de discussion autour de ce bug : https://bugs.launchpad.net/ubuntu/+sour … bug/201786
mais je n'y ai pas trouvé de solutions.

Quelqu'un aurait une idée, un tuyau, voire une solution ?

Merci d'avance,
Julien

Hors ligne

#7 Le 21/12/2010, à 18:52

julien_a

Re : Serveur SSH : Permission denied (publickey).

J'ai trouvé. C'était juste que les droits du home-directory du compte distant n'étaient pas positionnés à 755. Capricieux, tout de même, c'est le mot.

Hors ligne