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 06/08/2017, à 13:03

bloodangel78

[Résolu] LXC - Problème connexion ssh container debian

Bonjour,

Je suis sous Ubuntu 16.04 LTS.
J'ai un soucis avec le container "debian".
Je n'arrive pas a me connecter en ssh.

pc@pc-dell:~$ ssh root@intranet.lxc
Permission denied (publickey).

Je n'ai pas ce soucis avec le container "ubuntu" car LXC créé un utilisateur "ubuntu" avec comme mot de passe "ubuntu" par défaut.
Je peux donc bien m'y connecter en faisant: ssh ubuntu@ubuntu.lxc, puis je tape le mot de passe et c'est bon.

Mais pour le container debian donc, on a que l'utilisateur root et aucune info sur le mot de passe mis.
Par le passé j'avais mis la connexion ssh par clef et ça marchait mais la je n'arrive pas à le faire.

J'ai bien copié ma clef de mon utilisateur host ubuntu "id_rsa.pub" dans le dossier /home/lxc/intranet/rootfs/root/.ssh/authorized_keys
Mais rien n'y fait.
Les droits sont mis sur 775 sur le dossier ".ssh" de la lxc avec "pc:root" comme groupe

Voici la config de ma lxc debian situé dans /home/lxc/rootfs/etc/ssh/sshd_config:

#	$OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $

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

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

# 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
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
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes

#PubkeyAuthentication yes
PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile	.ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
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
IgnoreRhosts yes

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

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

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

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

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

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

# no default banner path
#Banner none

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

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

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server

Pourriez vous me dire si vous voyez une config qui ne va pas?

D'avance merci.

Dernière modification par bloodangel78 (Le 19/08/2017, à 14:04)

Hors ligne

#2 Le 06/08/2017, à 20:47

outcast

Re : [Résolu] LXC - Problème connexion ssh container debian

Sur debian la fameuse erreur 755 sur .ssh/
Mets du 700 et ça marchera.

Hors ligne

#3 Le 07/08/2017, à 04:12

Brunod

Re : [Résolu] LXC - Problème connexion ssh container debian

As-tu testé avec user "root", password "(rien)" comme semble l'autoriser la config ?


Windows est un système d'exploitation de l'homme par l'ordinateur. Linux, c'est le contraire...
39 pc linux convertis

Hors ligne

#4 Le 08/08/2017, à 00:58

bloodangel78

Re : [Résolu] LXC - Problème connexion ssh container debian

outcast a écrit :

Sur debian la fameuse erreai touur 755 sur .ssh/
Mets du 700 et ça marchera.

En effet le dossier était en 755.
J'ai essayé ceci:

chmod 700 /home/lxc/intranet/rootfs/root/.ssh

Puis:

chmod 700 -R /home/lxc/intranet/rootfs/root/.ssh

Mais j'ai toujours le même problème.

ssh root@intranet.lxc
Permission denied (publickey).

Concernant le ".ssh" de ma machine host, il est bien en 700

Hors ligne

#5 Le 08/08/2017, à 01:00

bloodangel78

Re : [Résolu] LXC - Problème connexion ssh container debian

Brunod a écrit :

As-tu testé avec user "root", password "(rien)" comme semble l'autoriser la config ?

Il est bien en authentification par clef, donc il ne demande pas de mot de passe (cf le message d'erreur dans mon post au dessus avec la pubkey)

Hors ligne

#6 Le 12/08/2017, à 22:03

Sub0

Re : [Résolu] LXC - Problème connexion ssh container debian

Pas plus d’infos avec ssh -v (ou -vv / -vvv) ?


Seule alternative au bépo acceptée = stylo/papier.

Hors ligne

#7 Le 19/08/2017, à 14:04

bloodangel78

Re : [Résolu] LXC - Problème connexion ssh container debian

J'ai regénéré une clef ssh sur ma machine hôte et cela fonctionne bien maintenant.

Je ne sais pas ce qu'avait ma clef ssh mais je ne pouvais pas me connecter a un serveur non plus.

Merci pour votre aide.

Hors ligne

#8 Le 19/08/2017, à 14:55

outcast

Re : [Résolu] LXC - Problème connexion ssh container debian

Ta clé date de quand ?
Parce qu'en 2008, une faille de sécurité a été découverte dans la génération de clés sous debian et un patch est sorti pour désactiver toutes ces clés.
https://wiki.debian.org/SSLkeys#Identifying_Weak_Keys
https://jblevins.org/log/ssh-vulnkey

Hors ligne

#9 Le 21/08/2017, à 10:40

bloodangel78

Re : [Résolu] LXC - Problème connexion ssh container debian

Je ne pense pas que c'était cela car ma clef datait d'une semaine avant mon premier post

Hors ligne