Ssh un souci à la première connexion ?

Bonjours,

je ne parviens pas a me connecter avec putty sur mon serveur (local) la première fois,
sauf si je me log sur la machine (avec le clavier)

je precise bien juste le fait de me loguer suffi a rendre la connextion possible.

installation neuve. minimal

cat /etc/ssh/ssh_config

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

Host *
#   ForwardAgent no
#   ForwardX11 no
#   ForwardX11Trusted yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   IdentityFile ~/.ssh/id_ecdsa
#   IdentityFile ~/.ssh/id_ed25519
#   Port 22
#   Protocol 2
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes

merci d’avance ,

désoler pour le texte écrit en gros je ne sai pas ce qu’il c est produit ni ou on le modifie??

Pas de souci pour la taille d’écriture, pour ce qui est du fichier de configuration fourni c’est le client ssh que tu nous a posté pas le serveur SSH.

Si je comprends bien tu cherche à te loguer depuis un poste du réseau local au serveur sur ce même réseau local ?

Pas de souci pour la taille d’écriture, pour ce qui est du fichier de configuration fourni c’est le client ssh que tu nous a posté pas le serveur SSH.

oups j’avai pas vu :sweat: , mai ou est ce que peux mettre en forme mon text ?
sinon voila le bon :slight_smile:

 cat /etc/ssh/sshd_config
#       $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj 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
#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 yes
#prohibit-password
#StrictModes yes
MaxAuthTries 10
#MaxSessions 10

#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
# 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 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
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
UseDNS yes
#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

oui en passant par la box. ce problème est vraiment bizzard ,

Merci pour ta réponse

lance ssh en ligne de commande et regarde les messages d’erreurs.

Pour du bloc venant d’un retour de commande tu peux utiliser ```
tu replace la même chose à la fin du bloc à éditer :wink:

salut
tu peux essayer un ping avant le ssh?
i lest possible que ta connexion soit fait par un plugin dans qui s’active à la connexion du bureau plutot que ce soit fait avant la connexion par exemple en utilisant /etc/network/interfaces et /etc/resolv.conf

sa ping:)

ping 192.168.0.11

Envoi d’une requête 'Ping'  192.168.0.11 avec 32 octets de données :
Réponse de 192.168.0.11 : octets=32 temps<1ms TTL=63
Réponse de 192.168.0.11 : octets=32 temps<1ms TTL=63
Réponse de 192.168.0.11 : octets=32 temps<1ms TTL=63
Réponse de 192.168.0.11 : octets=32 temps<1ms TTL=63

Statistiques Ping pour 192.168.0.11:
    Paquets : envoyés = 4, reçus = 4, perdus = 0 (perte 0%),
Durée approximative des boucles en millisecondes :
    Minimum = 0ms, Maximum = 0ms, Moyenne = 0ms

j’ai donc patienter et la connexion a pus ce faire étrange … je vais voir si ça persiste ou si sa s’améliore.

Bon le ping est obligatoire … tester 3 fois 3 fois c’est pareil. évidement pas moyen de savoir ce qui coince.

maintenant
nmap 192.168.0.11
ou
nmap -Pn 192.168.0.11
pour voir si les ports sont ouverts

parfois j’ai un pb avec mes protections : mon fail2ban m’empeche parfois de rentrer

tu pourrais aussi aller voir dans les logs : déjà /var/log/auth.log

pour nmap depuis windows sa risque d’être un peux compliquer :stuck_out_tongue:
Et non pas de doute les port sont ouvert , mai je parviens apparemment sans ping a me connecter après 1.10sec comme si le service mettait 3 jour pour ce lancer

Nov 19 07:19:13 mboxrox systemd-logind[462]: New seat seat0.
Nov 19 07:19:13 mboxrox systemd-logind[462]: Watching system buttons on /dev/input/event2 (Power Button)
Nov 19 07:19:13 mboxrox systemd-logind[462]: Watching system buttons on /dev/input/event0 (Power Button)
Nov 19 07:19:13 mboxrox systemd-logind[462]: Watching system buttons on /dev/input/event1 (Sleep Button)
Nov 19 07:19:13 mboxrox systemd-logind[462]: Watching system buttons on /dev/input/event6 (Logitech Gaming Mouse G502)
Nov 19 07:19:13 mboxrox systemd-logind[462]: Watching system buttons on /dev/input/event8 (Logitech USB Receiver)
Nov 19 07:19:13 mboxrox systemd-logind[462]: Watching system buttons on /dev/input/event9 (Logitech USB Receiver)
Nov 19 07:20:28 mboxrox sshd[669]: Server listening on 0.0.0.0 port 22.
Nov 19 07:20:28 mboxrox sshd[669]: Server listening on :: port 22.
Nov 19 07:20:32 mboxrox sshd[672]: Accepted password for root from 192.168.0.10 port 50615 ssh2
Nov 19 07:20:32 mboxrox sshd[672]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 19 07:20:32 mboxrox systemd-logind[462]: New session 1 of user root.
Nov 19 07:20:32 mboxrox systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0)

3 ou 4 essai depuis 07h19 , donc on dirai que le service me du temps a ce lancer , je peux peut-être lui donner une priorité de démarrage plus grande (courte?)
mai comment ?

Merci pour ta réponse

salut
peut etre en changeant l’ordre dans /etc/rc2.d

sinon se logguer en root c est pas très secure

oui pour root, m’enfin la toute mes commandes son passer aux niveau admin. une fois la configuration faite je ferai un scripte pour automatiser tout ça avec un installation propre.

La c est pour tester alors le pirate pour faire mumuse il a peux de temps pour sans servir de la becane s’il y parviens :wink: en plus c est en local :stuck_out_tongue:

je vais regarde du coter de /etc/rc2.d
merci pour le coup de pouce