Partage
  • Partager sur Facebook
  • Partager sur Twitter

Connexion SSH impossible !

Help

    4 février 2020 à 23:06:38

    Bonjour,

    Après avoir suivi plusieurs tutos, je ne peu toujours pas me connecter en SSH sur mon 2eme pc en linux également.


    Ni par localhost, 
    ni par internet av l ip

    J'ai essayé dans les 2 sens et la seul chose qui fonctionne c'est de me connecter en ssh sur le meme pc, ce qui ne sert a rien bien sur. J' ai tout de même testé de créer un fichier puis logout. le fichier etait bien present. 

    Ma config:

    1pc avec un compte: alex


    1pc avec un compte: alexandre

    Le tout sur linux connecté a ma box

    Test en local:

    ssh alex@localhost 

    -> demande de mots de passe 3 fois :

    alex@localhost: Permission denied (publickey,password)

    . j'ai précisé le mdp de l'utilisateur de la machine serveur ou je veux me connecter

    Test en ligne:

    ssh alex@"adr ip internet de ma box ou est connecté le pc serveur"


    en me connectant auparavant sur le modem de mon telephone pour tester en ligne. Après un certain temps jobtiens le message:

    ssh: connect to host (mon ip) port 22: Connection timed out

    Voici le fichier /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 prohibit-password
    #StrictModes yes
    #MaxAuthTries 6
    #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
    #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

    J' ai tester plein de choses et j'ai fini par desinstaler et purger  openssh-server et ssh
    puis:

    apt-get install openssh-server
    apt-get install ssh

    Voila une partie de /var/log/auth.log

    Feb  4 20:44:43 KALI sshd[6301]: Invalid user alex from ::1 port 58250
    Feb  4 20:44:46 KALI sshd[6301]: pam_unix(sshd:auth): check pass; user unknown
    Feb  4 20:44:46 KALI sshd[6301]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=::1 
    Feb  4 20:44:48 KALI sshd[6301]: Failed password for invalid user alex from ::1 port 58250 ssh2
    Feb  4 20:44:54 KALI sshd[6301]: pam_unix(sshd:auth): check pass; user unknown
    Feb  4 20:44:56 KALI sshd[6301]: Failed password for invalid user alex from ::1 port 58250 ssh2
    Feb  4 20:44:59 KALI sshd[6301]: pam_unix(sshd:auth): check pass; user unknown
    Feb  4 20:45:01 KALI CRON[6303]: pam_unix(cron:session): session opened for user root by (uid=0)
    Feb  4 20:45:01 KALI CRON[6303]: pam_unix(cron:session): session closed for user root
    Feb  4 20:45:02 KALI sshd[6301]: Failed password for invalid user alex from ::1 port 58250 ssh2
    Feb  4 20:45:03 KALI sshd[6301]: Connection closed by invalid user alex ::1 port 58250 [preauth]
    Feb  4 20:45:03 KALI sshd[6301]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=::1 
    Feb  4 20:45:33 KALI polkitd(authority=local): Registered Authentication Agent for unix-process:6317:1015947 (system bus name :1.378 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale fr_FR.UTF-8)
    Feb  4 20:45:42 KALI polkit-agent-helper-1[6326]: pam_unix(polkit-1:auth): authentication failure; logname= uid=0 euid=0 tty= ruser=root rhost=  user=root
    Feb  4 20:45:48 KALI polkitd(authority=local): Operator of unix-session:2 successfully authenticated as unix-user:root to gain TEMPORARY authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.379 [systemctl restart sshd.service] (owned by unix-user:alexandre)
    Feb  4 20:45:48 KALI polkitd(authority=local): Unregistered Authentication Agent for unix-process:6317:1015947 (system bus name :1.378, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale fr_FR.UTF-8) (disconnected from bus)
    Feb  4 20:46:18 KALI polkitd(authority=local): Registered Authentication Agent for unix-process:6356:1020358 (system bus name :1.404 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale fr_FR.UTF-8)
    Feb  4 20:46:22 KALI polkitd(authority=local): Operator of unix-session:2 successfully authenticated as unix-user:root to gain TEMPORARY authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.405 [systemctl start sshd.service] (owned by unix-user:alexandre)
    Feb  4 20:46:22 KALI polkitd(authority=local): Unregistered Authentication Agent for unix-process:6356:1020358 (system bus name :1.404, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale fr_FR.UTF-8) (disconnected from bus)
    Feb  4 20:50:25 KALI su: (to alexandre) alexandre on pts/3
    Feb  4 20:50:25 KALI su: pam_unix(su:session): session opened for user alexandre by alexandre(uid=0)
    Feb  4 20:51:01 KALI sshd[6415]: Invalid user alex from ::1 port 59026
    Feb  4 20:51:05 KALI sshd[6415]: pam_unix(sshd:auth): check pass; user unknown
    Feb  4 20:51:05 KALI sshd[6415]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=::1 
    Feb  4 20:51:07 KALI sshd[6415]: Failed password for invalid user alex from ::1 port 59026 ssh2
    Feb  4 20:51:12 KALI sshd[6415]: Failed password for invalid user alex from ::1 port 59026 ssh2
    Feb  4 20:51:14 KALI sshd[6415]: pam_unix(sshd:auth): check pass; user unknown
    Feb  4 20:51:17 KALI sshd[6415]: Failed password for invalid user alex from ::1 port 59026 ssh2
    Feb  4 20:51:18 KALI sshd[6415]: Connection closed by invalid user alex ::1 port 59026 [preauth]
    Feb  4 20:51:18 KALI sshd[6415]: PAM 1 more authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=::1 
    Feb  4 20:55:01 KALI CRON[6457]: pam_unix(cron:session): session opened for user root by (uid=0)
    Feb  4 20:55:01 KALI CRON[6457]: pam_unix(cron:session): session closed for user root
    Feb  4 21:03:53 KALI su: pam_unix(su:auth): Couldn't open /etc/securetty: Aucun fichier ou dossier de ce type
    Feb  4 21:03:55 KALI su: pam_unix(su:auth): Couldn't open /etc/securetty: Aucun fichier ou dossier de ce type
    Feb  4 21:03:55 KALI su: (to root) alexandre on pts/3
    Feb  4 21:03:55 KALI su: pam_unix(su:session): session opened for user root by alexandre(uid=1000)
    Feb  4 21:05:01 KALI CRON[6478]: pam_unix(cron:session): session opened for user root by (uid=0)
    Feb  4 21:05:01 KALI CRON[6478]: pam_unix(cron:session): session closed for user root
    Feb  4 21:09:01 KALI CRON[6489]: pam_unix(cron:session): session opened for user root by (uid=0)
    Feb  4 21:09:01 KALI CRON[6489]: pam_unix(cron:session): session closed for user root
    Feb  4 21:15:01 KALI CRON[6550]: pam_unix(cron:session): session opened for user root by (uid=0)
    Feb  4 21:15:01 KALI CRON[6550]: pam_unix(cron:session): session closed for user root
    Feb  4 21:17:01 KALI CRON[6556]: pam_unix(cron:session): session opened for user root by (uid=0)
    Feb  4 21:17:01 KALI CRON[6556]: pam_unix(cron:session): session closed for user root
    Feb  4 21:18:51 KALI su: (to alexandre) root on pts/2
    Feb  4 21:18:51 KALI su: pam_unix(su:session): session opened for user alexandre by (uid=0)
    Feb  4 21:21:41 KALI sudo: pam_unix(sudo:auth): Couldn't open /etc/securetty: Aucun fichier ou dossier de ce type
    Feb  4 21:21:50 KALI sudo: pam_unix(sudo:auth): Couldn't open /etc/securetty: Aucun fichier ou dossier de ce type
    Feb  4 21:21:50 KALI sudo: alexandre : user NOT in sudoers ; TTY=pts/2 ; PWD=/home/alexandre ; USER=root ; COMMAND=/usr/bin/cat /var/log/auth.log
    Feb  4 21:21:57 KALI su: pam_unix(su:auth): Couldn't open /etc/securetty: Aucun fichier ou dossier de ce type
    Feb  4 21:22:00 KALI su: pam_unix(su:auth): Couldn't open /etc/securetty: Aucun fichier ou dossier de ce type
    Feb  4 21:22:00 KALI su: (to root) root on pts/2
    Feb  4 21:22:00 KALI su: pam_unix(su:session): session opened for user root by (uid=1000)
    Feb  4 21:22:05 KALI sudo:     root : TTY=pts/2 ; PWD=/home/alexandre ; USER=root ; COMMAND=/usr/bin/cat /var/log/auth.log
    Feb  4 21:22:05 KALI sudo: pam_unix(sudo:session): session opened for user root by (uid=0)


    Merci à qui veux bien m'aider  hmm

    Ps: oui une version kali pour me former à la sécurité sur mon reseaux. Je ne compte pas installer d'autres distributions merci.

    Cdt


    Alex





    -
    Edité par kalounne 5 février 2020 à 0:28:53

    • Partager sur Facebook
    • Partager sur Twitter
      4 février 2020 à 23:29:46

      # $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 prohibit-password #StrictModes yes #MaxAuthTries 6 #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 #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

      tu arrives à le lire, ça ?
      moi, pas.

      s'il te plaît,  refais un copier-coller, en utilisant la balise code (le bouton </>), et vérifie que le format est lisible.

      • Partager sur Facebook
      • Partager sur Twitter

      Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique

        5 février 2020 à 0:17:57

        Je l'ai corrigé de moi meme pourtant quand je m' en suis aperçu. Bizare que le cache ne s'est pas actualisé ou autre. En tout cas la, ca ne pique plus les yeux lol. Dsl 

        -
        Edité par kalounne 5 février 2020 à 0:20:17

        • Partager sur Facebook
        • Partager sur Twitter
          5 février 2020 à 2:20:09

          merci.

          invalid user alex -> alex n'est pas un utilisateur du serveur.

          modifie PS1 pour faire apparaître le nom de l'utilisateur local :

          export PS1='[\u@\h \W]\$ '

          -
          Edité par dantonq 5 février 2020 à 2:32:30

          • Partager sur Facebook
          • Partager sur Twitter

          Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique

            5 février 2020 à 15:20:23

            Bonjour,

            Merci, j'ai essayé cette commande mais je ne la comprend pas.

            cela m'affiche à la place de:

            alex@kali:~$

            ceci:

            [alex@kali ~]$

            Mais rien de plus.

            Pourrais tu préciser d'avantage SVP?

            Par contre a partir de la  j'ai lancé avec une erreure un

            ssh alexanndre@localhost

            cela me dit :

            alex n'apparait pas dans le fichier sudoers. cet incident sera signalé


            j'ai fait une erreur de frape donc je recommence

            ssh alexandre@localhost

            Cette fois avec un seul "n" et cela me demande juste le mot de passe de alexandre 3 fois comme avant.

            Bien sur cela ne marche pas mieux mais est ce une piste le faite que alex ne sois pas dans sudoers?


            j'ai également poster ici pour des infos complémentaires si besoin:

            https://forum.ubuntu-fr.org/viewtopic.php?pid=22216477

            -
            Edité par kalounne 5 février 2020 à 15:44:10

            • Partager sur Facebook
            • Partager sur Twitter
              5 février 2020 à 16:09:30

              la commande donnée doit nous permettre de savoir qui initie les commandes.
              dans le cas présent (communication entre deux PC, et potentiellement entre deux utilisateurs), il est utile d'afficher le PROMPT (PS1) complet, au début des commandes que tu affiches sur le forum.

              par exemple :

              [ daniel@machinePerso ] $ ssh untel@machineDistante

              comme ça, on sait qui "appelle" qui d'autre.

              question idiote : quand tu as créé l'utilisateur alexandre, tu lui as attribué un mot de passe ?

              sudo ne devrait pas être impliqué dans la commande exécutée, il n'y a pas de raison qu'un tel message soit affiché.
              il y a un alias sur ssh ? que retourne : type ssh 
              je comprends ta discrétion, mais si tu caches une partie du problème, on ne pourra jamais trouver la solution.

              • Partager sur Facebook
              • Partager sur Twitter

              Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique

                5 février 2020 à 16:24:01

                Oui il y a bien un mot de passe pour alexandre.

                je viens de me deconnecter de la session root pour me co sur alexandre et j ai taper le mot de passe pour entrer dans la session.

                Voici le resultat de : type ssh

                alexandre@KALI:~$ type ssh
                ssh est /usr/bin/ssh
                

                 Que faudrait-il poster pour avancer?

                alex@Kali:~$ export PS1='[\u@\h \W]\$ '
                [alex@Kali ~]$ ssh alexandre@localhost
                alexandre@localhost's password:
                Permission denied, please try again.
                alexandre@localhost's password:
                Permission denied, please try again.
                alexandre@localhost's password:
                alexandre@localhost: Permission denied (publickey,password).
                [alex@Kali ~]$
                
                



                Il n'y a aucun mots de passe d'achat ou autre stocké sur mes 2 machines en linux ou quelque choses de sensible,  donc je ne suis pas tres soucieux de révéler certaines informations dans la mesure du raisonable.

                J'ai fait ces commandes dans les 2 sens. Ce sont les memes resultats sur les 2 pc!

                Voici le resultat de la commande nc qui me parrait positive:

                alexandre@KALI:~$ nc -zvw3 192.168.1.54 22

                Kali [192.168.1.54] 22 (ssh) open

                 alex@Kali:~$ nc -zvw3 192.168.1.67 22 

                KALI [192.168.1.67] 22 (ssh) open

                Pour le ping je n'ai pas su interpréter le résultat:

                alexandre@KALI:~$ ping 192.168.1.54 22

                 PING 22 (0.0.0.22) 56(124) bytes of data.

                 alex@Kali:~$ ping 192.168.1.67 22

                 PING 22 (0.0.0.22) 56(124) bytes of data.



                Je suis cher knet, je test de cher moi.

                sois en local tout sur la box

                sois en ligne :

                pc1: user alexandre connecté au modem de mon tel vers le pc 2 connecté a la box  = ( ssh alex@ip_knet)

                et inversement:

                pc2: user alex connecté sur la box vers le pc 1 connecté au modem tel = (ssh alexandre@ip_modem_tel)

                Merci bien en tout cas

                -
                Edité par kalounne 5 février 2020 à 16:46:54

                • Partager sur Facebook
                • Partager sur Twitter
                  5 février 2020 à 17:28:24

                  :~$ ssh-keygen   # ????

                  Back to basics :)  https://duckduckgo.com/?q=kali+setup+SSH

                  • Partager sur Facebook
                  • Partager sur Twitter
                    5 février 2020 à 17:55:21

                    Bonsoir MichaelGroman,

                    Merci pour le tuto. Je l'ai suivis a la lettre et voici le résultat:

                    root@KALI:/home/alexandre# mkdir /etc/ssh/default_keys
                    root@KALI:/home/alexandre# mv /etc/ssh/ssh_host_* /etc/ssh/default_keys/
                    root@KALI:/home/alexandre# dpkg-reconfigure openssh-server
                    Creating SSH2 RSA key; this may take some time ...
                    3072 SHA256:YryFTOauK6zbl8n+Vz81IFrn03Oeqp9ReK6EiJR4K2k root@KALI (RSA)
                    Creating SSH2 ECDSA key; this may take some time ...
                    256 SHA256:nLY0OJSVZVgxxJM6iHpaA68zNaOq+ZiJ72BZEP5gPdA root@KALI (ECDSA)
                    Creating SSH2 ED25519 key; this may take some time ...
                    256 SHA256:dLpXKneskSqSeecIckNyaj80YnThOgretZDOQo4RlOE root@KALI (ED25519)
                    rescue-ssh.target is a disabled or a static unit, not starting it.
                    root@KALI:/home/alexandre# nano /etc/ssh/sshd_config
                    root@KALI:/home/alexandre# systemctl start ssh.socket
                    root@KALI:/home/alexandre# systemctl stop ssh.socket
                    root@KALI:/home/alexandre# systemctl enable ssh.service
                    Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
                    Executing: /lib/systemd/systemd-sysv-install enable ssh
                    Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
                    Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service.
                    root@KALI:/home/alexandre# systemctl start ssh.service
                    root@KALI:/home/alexandre# systemctl status ssh.service
                    ● ssh.service - OpenBSD Secure Shell server
                         Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: disabled)
                         Active: active (running) since Wed 2020-02-05 17:49:05 CET; 18s ago
                           Docs: man:sshd(8)
                                 man:sshd_config(5)
                        Process: 6107 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
                       Main PID: 6108 (sshd)
                          Tasks: 1 (limit: 18989)
                         Memory: 1.2M
                         CGroup: /system.slice/ssh.service
                                 └─6108 /usr/sbin/sshd -D
                    
                    févr. 05 17:49:05 KALI systemd[1]: Starting OpenBSD Secure Shell server...
                    févr. 05 17:49:05 KALI sshd[6108]: Server listening on 0.0.0.0 port 22.
                    févr. 05 17:49:05 KALI sshd[6108]: Server listening on :: port 22.
                    févr. 05 17:49:05 KALI systemd[1]: Started OpenBSD Secure Shell server.
                    root@KALI:/home/alexandre# su alexandre
                    alexandre@KALI:~$ ssh alex@localhost
                    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                    @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
                    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
                    Someone could be eavesdropping on you right now (man-in-the-middle attack)!
                    It is also possible that a host key has just been changed.
                    The fingerprint for the ECDSA key sent by the remote host is
                    SHA256:nLY0OJSVZVgxxJM6iHpaA68zNaOq+ZiJ72BZEP5gPdA.
                    Please contact your system administrator.
                    Add correct host key in /home/alexandre/.ssh/known_hosts to get rid of this message.
                    Offending ECDSA key in /home/alexandre/.ssh/known_hosts:1
                      remove with:
                      ssh-keygen -f "/home/alexandre/.ssh/known_hosts" -R "localhost"
                    ECDSA host key for localhost has changed and you have requested strict checking.
                    Host key verification failed.
                    
                    alexandre@KALI:~$ ssh-keygen -f "/home/alexandre/.ssh/known_hosts" -R "localhost"
                    # Host localhost found: line 1
                    /home/alexandre/.ssh/known_hosts updated.
                    Original contents retained as /home/alexandre/.ssh/known_hosts.old

                    alexandre@KALI:~$ ssh alex@192.168.1.54
                    ssh: connect to host 192.168.1.54 port 22: Connection refused

                     alexandre@KALI:~$ ssh alex@localhost
                    The authenticity of host 'localhost (::1)' can't be established. ECDSA key fingerprint is SHA256:nLY0OJSVZVgxxJM6iHpaA68zNaOq+ZiJ72BZEP5gPdA. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts. alex@localhost: Permission denied (publickey). alexandre@KALI:~$ ssh alex@localhost alex@localhost: Permission denied (publickey).


                    Je suis bien propre maintenant :o



                    -
                    Edité par kalounne 5 février 2020 à 18:21:17

                    • Partager sur Facebook
                    • Partager sur Twitter
                      5 février 2020 à 18:18:12

                      ssh-keygen -f "/home/alexandre/.ssh/known_hosts" -R "localhost" 
                      
                      Le message dans votre terminal ne pouvait pas être plus clair. Aussi je vous suggère de changer de port:22 etc....Rappelez-vous si vous n'avez pas mis en place d'utilisateurs supplémentaires, vous connectez comme ROOT!

                      -
                      Edité par C9H13N 5 février 2020 à 18:20:02

                      • Partager sur Facebook
                      • Partager sur Twitter
                        5 février 2020 à 18:33:26

                        j'ai lu que tu ne veux utiliser d'autre distribution,
                        mais, il faut quand même identifier si ce comportement est dû, ou pas, à Kali ?

                        afin d'éliminer cette possibilité, j'installerais une autre distro (légère, pour ne pas passer des plombes à l'installation).

                        • Partager sur Facebook
                        • Partager sur Twitter

                        Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique

                          5 février 2020 à 18:41:03

                          :waw:

                          Je suis d'accord avec @dantonq, si vous avez autant de problèmes de lire/déchiffrer votre terminal pour arriver là où vous devez être, vous ne devriez pas utiliser Kali.

                          ou
                          config: AllowTcpForwarding no
                          :~$ ssh -v localhost
                          ou
                          ssh-keygen -t rsa #nouveau publickey -b <bit key>
                          :~$ ssh -v localhost


                          Additional info:
                          https://help.ubuntu.com/community/SSH/OpenSSH/Configuring
                          https://help.ubuntu.com/community/SSH/OpenSSH/Keys#keys-with-specific-commands


                          Good luck.

                          l'erreur publickey signifie qu'aucune "publickey" n'est trouvée. Tu l'as enlevé, souviens-toi

                          -
                          Edité par C9H13N 5 février 2020 à 18:52:01

                          • Partager sur Facebook
                          • Partager sur Twitter
                            5 février 2020 à 19:55:01

                            vous ne devriez pas utiliser Kali

                            ce n'est exactement ce que j'ai dit :

                            j'ai proposé de comparer le comportement d'une autre distribution.

                            bien que Kali ne soit pas destinée à être utilisée tous les jours. on peut, mais ce n'est pas fait pour ça.

                            • Partager sur Facebook
                            • Partager sur Twitter

                            Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique

                              5 février 2020 à 20:49:01

                              Je vais tester avec 2 ubuntu sur virtual box.

                              je viens de réinstaler kali tt propre sur 1 pc  vs ubuntu sur virtual box sur le 2ème pc et ca change rien.

                              • Partager sur Facebook
                              • Partager sur Twitter
                                5 février 2020 à 20:57:56

                                Je pense que vous ne lisez pas les instructions complètes assez bien.

                                La réinstallation ne résoudra pas vos problèmes. C'est une question de configuration. S'il vous plaît voir les liens comme donné ci-dessus, les lire attentivement. Et configurez votre SSH au fur et à mesure de vos besoin.
                                • Partager sur Facebook
                                • Partager sur Twitter
                                  5 février 2020 à 23:07:59

                                  Merci mais effectivement je ne lis pas l'anglais aussi bien que le français.

                                  C'est pour cette raison que je cherchais de l'aide sur ce forum.

                                  Je suivais le tuto linux d'openclassrooms donc je suis au bonne endroit.

                                  Rien n'est a configurer normalement.

                                  Plus d'histoire de kali, maintenant J'ai les 2 pc connecté sur ubuntu sur virtual box.

                                  Je n'est rien installé et quand je test de me connecté à l'autre machine j'obtiens:

                                  alex@Alex:~$ ssh alex@192.168.1.29
                                  ssh: connect to host 192.168.1.29 port 22: Connection timed out

                                  Si cela vous embêtes ne répondez pas merci. Je cherche quelqu'un de patient pour me guider

                                  • Partager sur Facebook
                                  • Partager sur Twitter
                                    5 février 2020 à 23:26:37

                                    virtualBox ajoute une couche de configuration.

                                    fais les choses en vrai.

                                    as-tu modifié les paramètres de ta box ? réinitialise les paramètres par défaut.

                                    puis, installe, sur les deux PC, une distribution légère (pour ne pas passer des heures sur l'installation d'Ubuntu).

                                    puis reprends pas à pas, pour nous, ce que tu fais avant d'initier une connexion SSH entre les PC.

                                    depuis le temps que ça dure, les PC méritent une installation propre, réelle.

                                    • Partager sur Facebook
                                    • Partager sur Twitter

                                    Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique

                                      6 février 2020 à 7:20:15

                                      Essayez les commandes suivantes.

                                      edit +  | -- my bad :)

                                      ssh restart ->  systemctl restart ssh.service
                                      ps aux  | grep "22" -> nmap -sTU -O 192.168.1.29

                                      # Ping ip
                                      ping 192.168.1.29
                                      
                                      # Il y as une service sur le port 22 ?
                                      ps aux | grep "22"
                                      
                                      # Status service
                                      /etc/init.d/ssh status
                                      
                                      # Se connectant en utilisant ci-dessous
                                      ssh -v localhost -p 22
                                      
                                      # Redémarrer le service
                                      # service ssh restart

                                      -
                                      Edité par C9H13N 6 février 2020 à 8:58:23

                                      • Partager sur Facebook
                                      • Partager sur Twitter
                                        6 février 2020 à 7:42:58

                                        ps aux | grep 22

                                        il manque le pipe, et ça va faire remonter ds PID comme 882211, qui n'ont rien à voir avec SSH.

                                        /etc/init.d/ssh status

                                        Kali est encore sous SysVInit ?

                                        • Partager sur Facebook
                                        • Partager sur Twitter

                                        Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique

                                          6 février 2020 à 7:56:07

                                          C'est pas  bien d'utiliser kali 😉
                                          • Partager sur Facebook
                                          • Partager sur Twitter
                                            6 février 2020 à 10:20:21

                                            Bash script (Basic installation - tested!)

                                            Save as sshinstall.sh or .....

                                            chmod +x sshinstall.sh  # "nameofscript.sh"

                                            su -

                                            now execute as root

                                            when password is requested enter ROOT password

                                            result: "debug1: Authentication succeeded (password)"

                                            #!/bin/sh
                                            read -p "DiD you already install SSH Yes or no? " answer
                                            if [ "$answer" != "${answer#[Yy]}" ] ;then
                                            	echo "Purging install"
                                            	apt-get purge ssh -y
                                            else
                                            	echo "starting install"
                                            fi
                                            
                                            apt-get install ssh -y
                                            echo "Making a copy of your SSH configuration"
                                            cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults
                                            echo "Please edit your /etc/ssh/sshd_config first\nAdd: PermitRootLogin yes just below #PermitRootLogin prohibit-password\nUsing the following command:\nnano /etc/ssh/sshd_config\n"
                                            
                                            read -p "Did you edit your config file ? Yes or no? " edited
                                            if [ "$edited" != "${edited#[Yy]}" ] ;then
                                            	systemctl enable ssh
                                            	service ssh start
                                            	echo "Connecting"
                                            	ssh -v localhost 22
                                            else
                                            	echo "You did NOT follow instructions!"
                                            fi

                                            Dans votre premier post, ce qui manquait était l'exécution suivante suivie par la copie de cette clé ou de le lier à un compte utilisateur.

                                            ssh-keygen -t rsa #(optional +  "ssh-keygen -t -b 4096" sans ") Il vous demandera de lui donner un nom, fichier sera dan /root/.ssh/

                                            ssh-keygen -t rsa
                                            ssh-copy-id -i ~/.ssh/nomme_de_votre_cle


                                            Montrez-moi le contenu de la commande suivante si vous avez du problem

                                            ls /root/.ssh/


                                            Comme il devra être lié à l'user@account, exemple:

                                            ssh-copy-id -i ~/.ssh/nomme_de_votre_cle root@localhost


                                            Et redémarrez votre service. (Je n'ai pas inclus ce qui précède dans la coquille car il était seulement destiné à vous fournir un exemple de travail simple vous montrant qu'il se connectera.

                                            Si "time-out" -> Peut-être mauvais IP / Gateway ...., peut-être bloqué par un Firewall ou autre.

                                            config: Hostkeys / PubkeyAuth ..... only if you have generated a key using ssh-keygen -t rsa #(optional +  "ssh-keygen -t -b 4096" sans ")

                                            # Package generated configuration file
                                            # See the sshd_config(5) 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
                                            HostKey /etc/ssh/ssh_host_ecdsa_key
                                            HostKey /etc/ssh/ssh_host_ed25519_key
                                            #Privilege Separation is turned on for security
                                            UsePrivilegeSeparation yes
                                            
                                            # Lifetime and size of ephemeral version 1 server key
                                            KeyRegenerationInterval 3600
                                            ServerKeyBits 1024
                                            
                                            # Logging
                                            SyslogFacility AUTH
                                            LogLevel INFO
                                            
                                            # Authentication:
                                            LoginGraceTime 120
                                            #PermitRootLogin without-password
                                            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 no
                                            
                                            # 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 yes
                                            
                                            # 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
                                            
                                            # 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
                                            Banner /etc/issue.net

                                            My result: I've added a welcome text. using Banner /etc/issue.net

                                            p0wn3d@kali:~# ssh root@localhost
                                            ###############################################################
                                            #             Welcome to Kali GNU/Linux Rolling SSH           # 
                                            #          All connections are monitored and recorded         #
                                            #  Disconnect IMMEDIATELY if you are not an authorized user!  #
                                            ###############################################################
                                            Enter passphrase for key '/root/.ssh/id_rsa': 
                                            Linux kali 5.4.0-kali3-amd64 #1 SMP Debian 5.4.13-1kali1 (2020-01-20) x86_64



                                            -
                                            Edité par C9H13N 6 février 2020 à 17:25:04

                                            • Partager sur Facebook
                                            • Partager sur Twitter
                                              6 février 2020 à 16:50:15

                                              kalounne a écrit:

                                              Bonjour,

                                              Après avoir suivi plusieurs tutos, je ne peu toujours pas me connecter en SSH sur mon 2eme pc en linux également

                                              Ni par localhost, 
                                              ni par internet av l ip

                                              J'ai essayé dans les 2 sens et la seul chose qui fonctionne c'est de me connecter en ssh sur le meme pc, ce qui ne sert a rien bien sur. J' ai tout de même testé de créer un fichier puis logout. le fichier etait bien present. 

                                              Ma config:

                                              1pc avec un compte: alex


                                              1pc avec un compte: alexandre

                                              Le tout sur linux connecté a ma box

                                              Salut tu peux donner le contenue de `/etc/ssh/sshd_config` pour tes deux machines stp ?

                                              as tu testé la connection en localhost sur les deux machines ?

                                              Pour ton test depuis internet, c'est normal, si ça ne passe deja pas en locall ça ne pourra pas le faire depuis internet, et as tu pensé au ouverture et redirection de port sur ta box ?

                                              • Partager sur Facebook
                                              • Partager sur Twitter

                                              la connaissance est une chose qui ne nous appauvrit pas quand on la partage.

                                              Mon GitHub

                                                6 février 2020 à 17:19:58

                                                Dans votre premier post, ce qui manquait était l'exécution suivante suivie par la copie de cette clé ou de le lier à un compte utilisateur.

                                                ssh-keygen -t rsa #(optional +  "ssh-keygen -t -b 4096" sans ") Il vous demandera de lui donner un nom, fichier sera dan /root/.ssh/

                                                ssh-keygen -t rsa
                                                ssh-copy-id -i ~/.ssh/nomme_de_votre_cle


                                                Montrez-moi le contenu de la commande suivante si vous avez du problem

                                                ls /root/.ssh/


                                                Comme il devra être lié à l'user@account, exemple:

                                                ssh-copy-id -i /.ssh/nomme_de_votre_cle root@localhost


                                                Et redémarrez votre service. (Je n'ai pas inclus ce qui précède dans le script bash car il était seulement destiné à vous fournir un exemple simple vous montrant qu'il se connectera.

                                                Si "time-out" -> Peut-être mauvais IP / Gateway ...., peut-être bloqué par un Firewall ou autre.

                                                config: Hostkeys / PubkeyAuth ..... only if you have generated a key using ssh-keygen -t rsa #(optional +  "ssh-keygen -t -b 4096" sans ")

                                                # Package generated configuration file
                                                # See the sshd_config(5) 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
                                                HostKey /etc/ssh/ssh_host_ecdsa_key
                                                HostKey /etc/ssh/ssh_host_ed25519_key
                                                #Privilege Separation is turned on for security
                                                UsePrivilegeSeparation yes
                                                
                                                # Lifetime and size of ephemeral version 1 server key
                                                KeyRegenerationInterval 3600
                                                ServerKeyBits 1024
                                                
                                                # Logging
                                                SyslogFacility AUTH
                                                LogLevel INFO
                                                
                                                # Authentication:
                                                LoginGraceTime 120
                                                #PermitRootLogin without-password
                                                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 no
                                                
                                                # 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 yes
                                                
                                                # 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
                                                
                                                # 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
                                                Banner /etc/issue.net

                                                My result: I've added a welcome text. using Banner /etc/issue.net

                                                p0wn3d@kali:~# ssh root@localhost
                                                ###############################################################
                                                #             Welcome to Kali GNU/Linux Rolling SSH           # 
                                                #          All connections are monitored and recorded         #
                                                #  Disconnect IMMEDIATELY if you are not an authorized user!  #
                                                ###############################################################
                                                Enter passphrase for key '/root/.ssh/id_rsa': 
                                                Linux kali 5.4.0-kali3-amd64 #1 SMP Debian 5.4.13-1kali1 (2020-01-20) x86_64



                                                -
                                                Edité par C9H13N 6 février 2020 à 17:22:15

                                                • Partager sur Facebook
                                                • Partager sur Twitter
                                                  6 février 2020 à 21:47:21

                                                  @C9H13N Bonsoir, je viens de sortir des spams votre dernier message, si cela ce reproduit encore vous pouvez poster dans ce sujet => Si votre message est considéré comme spam
                                                  • Partager sur Facebook
                                                  • Partager sur Twitter
                                                    7 février 2020 à 23:07:40

                                                    Bonsoir et merci a tous, je ne m'attendais pas à autant de réponses sinon j'aurais persisté avec kali :)

                                                    J'ai voulu suivre vos conseils pour avancer et donc jai viré mes 2 kali pour installer ubuntu en dur sur mes 2 machines, supprimer les règles nat sur ma box, je l'ai redémarré.
                                                    Installé openssh-serversur sur le pc qui sera serveur.
                                                    Je teste de me connecté au serveur avec le client en local:

                                                    alexandre@msi:~$ ssh alexandre-hp@192.168.1.29
                                                    
                                                    alexandre-hp@192.168.1.29's password: 
                                                    Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-28-generic x86_64)
                                                    
                                                     * Documentation:  https://help.ubuntu.com
                                                     * Management:     https://landscape.canonical.com
                                                     * Support:        https://ubuntu.com/advantage
                                                    
                                                    
                                                     * Canonical Livepatch is available for installation.
                                                       - Reduce system reboots and improve kernel security. Activate at:
                                                         https://ubuntu.com/livepatch
                                                    
                                                    0 paquet peut être mis à jour.
                                                    0 mise à jour de sécurité.
                                                    
                                                    Your Hardware Enablement Stack (HWE) is supported until April 2023.
                                                    Last login: Fri Feb  7 20:28:38 2020 from 192.168.1.67
                                                    alexandre-hp@hp:~$ logout


                                                    Cela marche très bien mais toujours pas en ligne:

                                                    alexandre@msi:~$ ssh alexandre-hp@111.111.111.1
                                                    ssh: connect to host 111.111.111.1 port 22: Connection timed out

                                                    J'ai essayé de configurer le fichier sshd_config et redémmarer le service ssh

                                                    sudo systemctl restart sshd.service

                                                      mais en vain.

                                                    #    $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm 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 prohibit-password
                                                    #StrictModes yes
                                                    #MaxAuthTries 6
                                                    #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
                                                    #UseLogin no
                                                    #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
                                                    AllowUsers alexandre

                                                    Je ferais les tentatives que vous me conseillerez avec plaisir!

                                                    Merci d'avance




                                                    -
                                                    Edité par kalounne 7 février 2020 à 23:08:04

                                                    • Partager sur Facebook
                                                    • Partager sur Twitter
                                                      7 février 2020 à 23:46:43

                                                      111.111.111.1 représente ton "adresse publique", c'est-à-dire l'adresse de ta box vue d'internet, c'est ça ?

                                                      alors il faut mettre des règles sur la box pour qu'elle transmette depuis le port 22 extérieur vers le port 22 de la machine serveur.

                                                      mais, il arrive que depuis l'intérieur il ne soit pas possible de joindre la patte externe.
                                                      un peu comme si tu voulais mettre du courrier dans ta boîte à lettre sans pouvoir sortir.

                                                      de mon temps, mon p'tit gars, :) quand je m'intéressais à la configuration réseau, il y existait des sites de tests de ports, qui me disaient si tel ou tel port était joignable, quand le service répondait...

                                                      • Partager sur Facebook
                                                      • Partager sur Twitter

                                                      Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique

                                                        7 février 2020 à 23:59:53

                                                        Salut, oui c'est bien l'adresse ip de ma box.

                                                         

                                                        Pour le test en ligne je me connecte de la machine client sur le modem de mon tel, le serveur est lui sur la connexion de ma box.

                                                        NomProtocole    IP source      Port source        ip destination  Port destination  

                                                            ssh        TCP                    ?                           22                     192.168.1.29                 22

                                                        Pour l' IP source je met pareil que l'ip de destination ou l'ip internet du client SVP ?

                                                        Tu as quel age sans indiscrétion? J'ai suivi une formation linux pendant 6 mois en 2006 mais depuis je n'y avais pas retouché lol

                                                        -
                                                        Edité par kalounne 8 février 2020 à 0:16:32

                                                        • Partager sur Facebook
                                                        • Partager sur Twitter
                                                          8 février 2020 à 0:37:41

                                                          Port 22
                                                          
                                                          HostKey /etc/ssh/ssh_host_rsa_key <-- ?? 
                                                          HostKey /etc/ssh/ssh_host_ecdsa_key <-- ??
                                                          HostKey /etc/ssh/ssh_host_ed25519_key <-- ??
                                                           
                                                          #PermitRootLogin prohibit-password
                                                          PermitRootlogin yes 
                                                          # <--?? port 22
                                                          Ubuntu le rendra probablement un peu plus facile pour vous. Plus de soutien
                                                          • Partager sur Facebook
                                                          • Partager sur Twitter
                                                            8 février 2020 à 0:47:23

                                                            c'était une vanne. j'ai vingt et un certain nombre d'années. :)
                                                            mais, c'est étrange de considérer qu'on a eu "une vie", qu'elle a changée, et qu'on oublie.

                                                            Hier encore j'avais vingt ans..."

                                                            :D

                                                            plus sérieusement
                                                            je n'ai pas à configurer l'IP source sur ma box, donc je ne sais pas.
                                                            a priori, sur la Box, je dirais qu'il faut indiquer l'IP externe de la Box comme adresse source.

                                                            • Partager sur Facebook
                                                            • Partager sur Twitter

                                                            Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique

                                                              8 février 2020 à 0:53:45

                                                              Pour savoir le ip

                                                              ifconfig

                                                              IP SOURCE:port -> Destination:port

                                                              je_connect_de_10.10.10.5:5000 -> 111.111.111.1:22

                                                              ssh Alex@111.111.111.1:5000





                                                              • Partager sur Facebook
                                                              • Partager sur Twitter

                                                              Connexion SSH impossible !

                                                              × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
                                                              × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
                                                              • Editeur
                                                              • Markdown