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.
. 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:
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
Ps: oui une version kali pour me former à la sécurité sur mon reseaux. Je ne compte pas installer d'autres distributions merci.
# $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.
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
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
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.
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.
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
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 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).
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!
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
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.
# 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
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
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 ?
la connaissance est une chose qui ne nous appauvrit pas quand on la partage.
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
@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
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!
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...
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
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..."
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.
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
× 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.
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
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!
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
la connaissance est une chose qui ne nous appauvrit pas quand on la partage.
Mon GitHub
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique