[SSH] un compte refuse toutes les clefs

Applications, problèmes de configuration réseau
Avatar de l’utilisateur
PowaBanga
archer de cavalerie
Messages : 175
Inscription : mar. 12 sept. 2017, 21:15

[SSH] un compte refuse toutes les clefs

Message par PowaBanga »

Salut à tous,
je galère pas mal à comprend pourquoi mon compte "powabanga" refuse toute les clef ssh sur ma machine. Je peux essayer depuis une autre, même celle-ci, c'est comme si elle n'avait pas recu la clef publique. Ma clef publique est bien présente dans le fichier authorized_keys... je ne comprend pas... :cry:

Code : Tout sélectionner

ssh-copy-id ArchiPavilion                                                                                                                                                                                       255 
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 4 key(s) remain to be installed -- if you are prompted now it is to install the new keys
powabanga@localhost's password: 

Number of key(s) added: 4

Now try logging into the machine, with:   "ssh 'ArchiPavilion'"
and check to make sure that only the key(s) you wanted were added.

 powabanga  ~  .ssh  ssh ArchiPavilion              
powabanga@localhost's password: 

Code : Tout sélectionner

 powabanga  ~  .ssh  pwd                                                                                                                                                                                                          SIGINT 
/home/powabanga/.ssh
 powabanga  ~  .ssh  ls -l         
total 60
-rw------- 1 powabanga powabanga 3369 27 oct  2022 AUR_id
-rw------- 1 powabanga powabanga  732 27 oct  2022 AUR_id.pub
-rw------- 1 powabanga powabanga 8829 20 oct 18:38 authorized_keys
-rw------- 1 powabanga powabanga 3369 10 mai 12:22 bang_rsa
-rw------- 1 powabanga powabanga  749 11 mai 15:19 bang_rsa.pub
-rw------- 1 powabanga powabanga 1706 26 sep 21:20 config
-rw------- 1 powabanga powabanga 3389 21 jan  2022 id_rsa
-rw------- 1 powabanga powabanga  757 21 jan  2022 id_rsa.pub
-rw------- 1 powabanga powabanga 4042  5 oct 15:19 known_hosts
-rw------- 1 powabanga powabanga 3294  5 oct 15:19 known_hosts.old
-rw------- 1 powabanga powabanga 3369 10 mai 15:09 powabanga_rsa
-rw------- 1 powabanga powabanga 2622 17 oct 19:03 tunneller_rsa
-rw------- 1 powabanga powabanga  583 17 oct 19:04 tunneller_rsa.pub
 

Code : Tout sélectionner

powabanga  ~  .ssh  ls -l /etc/ssh 
total 624
-rw-r--r-- 1 root root 587027  4 oct 18:11 moduli
-rw-r--r-- 1 root root   1536  4 oct 18:11 ssh_config
drwxr-xr-x 2 root root   4096  9 sep 10:08 ssh_config.d
-rw-r--r-- 1 root root   3127  4 oct 18:11 sshd_config
drwxr-xr-x 2 root root   4096  5 oct 16:11 sshd_config.d
-rw------- 1 root root   1381 27 déc  2021 ssh_host_dsa_key
-rw-r--r-- 1 root root    608 27 déc  2021 ssh_host_dsa_key.pub
-rw------- 1 root root    513 27 déc  2021 ssh_host_ecdsa_key
-rw-r--r-- 1 root root    180 27 déc  2021 ssh_host_ecdsa_key.pub
-rw------- 1 root root    411 27 déc  2021 ssh_host_ed25519_key
-rw-r--r-- 1 root root    100 27 déc  2021 ssh_host_ed25519_key.pub
-rw------- 1 root root   2602 27 déc  2021 ssh_host_rsa_key
-rw-r--r-- 1 root root    572 27 déc  2021 ssh_host_rsa_key.pub

Code : Tout sélectionner

 powabanga  ~  .ssh  cat config                 
Host rpi3
    User powabanga
    HostName 90.92.342.12
    Port 55000
    IdentityFile /home/powabanga/.ssh/bang_rsa
Host ArchiPavilion
    User powabanga
    HostName localhost 
    Port 7623
    ProxyJump rpi3

Code : Tout sélectionner

 powabanga  ~  .ssh  cat /etc/ssh/sshd_config   
# Include drop-in configurations
Include /etc/ssh/sshd_config.d/*.conf

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile	.ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

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

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#KbdInteractiveAuthentication yes

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

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the KbdInteractiveAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin prohibit-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and KbdInteractiveAuthentication to 'no'.
#UsePAM no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem	sftp	/usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server
Quelqu'un à une idée pour résoudre cela ?
Avatar de l’utilisateur
benjarobin
Maître du Kyudo
Messages : 17239
Inscription : sam. 30 mai 2009, 15:48
Localisation : Lyon

Re: [SSH] un compte refuse toutes les clefs

Message par benjarobin »

Bonjour,
Tu peux expliquer plus clairement le problème ?
Nom des machines, avec les ports des services, le nom des utilisateurs ssh, le nom des clé ssh, ...
Éventuellement avec un schéma.
Zsh | KDE | PC fixe : core i7, carte nvidia
Titre d'un sujet : [Thème] Sujet (état) / Règles du forum
Avatar de l’utilisateur
PowaBanga
archer de cavalerie
Messages : 175
Inscription : mar. 12 sept. 2017, 21:15

Re: [SSH] un compte refuse toutes les clefs

Message par PowaBanga »

J'avoue que pour moi cela peut sembler clair, mais il est évident que ma config est à revoir, et à nettoyer, c'est en court...

Voici un chéma qui répondra à tes questions, du moin je l'espère

Image

donc en gros j'ai un tunnel qui se connecte à RPI3 (en orange), de sorte que si le laptop sort du réseau, je peux toujours m'y connecter, avec ma deuxième machine par exemple (machine2),comme sur le schéma ci dessous.

Image

ce qui m'étonne, c'est que si je me connecte avec machine2 sur ArchiPavilion avec l'utilisateur root, ben cela fonctionne, mais via powabanga ben non, il continue de me demander mon mot de passe malgré mon ssh-copy-id.

Image

Mais, je pense que mon souci n'a rien à voir avec le réseau. Il me semble venir spécifiquement de ma machine "ArchiPavilion". Si j'essaye de me connecter dessus via localhost, le problème persiste

Code : Tout sélectionner

  ArchiPavilion  powabanga  ~  ssh-copy-id localhost               SIGINT 
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/powabanga/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
powabanga@localhost's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'localhost'"
and check to make sure that only the key(s) you wanted were added.

  ArchiPavilion  powabanga  ~  ssh localhost        
powabanga@localhost's password: 
Normalement il ne devrait plus me demander le mot de passe utilisateur, et devrait se connecter tout seul
Répondre