1 votes

ssh : permissions dans les fichiers /etc

Je pense que j'ai cassé les permissions pour (au moins) les fichiers dans /etc, et c'est pourquoi ssh ne fonctionne plus. hosts.allow :

sshd : ALL
ALL : ALL

hosts.deny :

sshd: ALL

hôtes :

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost

sortie de ssh localhost :

kex_exchange_identification: read: Connection reset by peer
Connection reset by ::1 port 22

sortie de ls -ld /etc /etc/ssh* /etc/ssh*/* :

lrwxr-xr-x@  1 root  wheel      11  1   2020 /etc -> private/etc
drwxrwxr-x  13 root  wheel     416  2  23:26 /etc/ssh
-rwxrwxr-x   1 root  wheel  577388  1   2020 /etc/ssh/moduli
-rwxrwxr-x   1 root  wheel    1511  1   2020 /etc/ssh/ssh_config
-rwxrwxr-x   1 root  wheel    1405 22  18:22 /etc/ssh/ssh_host_dsa_key
-rwxrwxr-x   1 root  wheel     620 22  18:22 /etc/ssh/ssh_host_dsa_key.pub
-rwxrwxr-x   1 root  wheel     525 22  18:23 /etc/ssh/ssh_host_ecdsa_key
-rwxrwxr-x   1 root  wheel     192 22  18:23 /etc/ssh/ssh_host_ecdsa_key.pub
-rwxrwxr-x   1 root  wheel     387  2  23:26 /etc/ssh/ssh_host_ed25519_key
-rwxrwxr-x   1 root  wheel      82  2  23:26 /etc/ssh/ssh_host_ed25519_key.pub
-rwxrwxr-x   1 root  wheel    2622 22  18:22 /etc/ssh/ssh_host_rsa_key
-rwxrwxr-x   1 root  wheel     584 22  18:22 /etc/ssh/ssh_host_rsa_key.pub
-rwxrwxr-x   1 root  wheel    3169  1   2020 /etc/ssh/sshd_config

sudo /usr/sbin/sshd -dD :

debug1: sshd version OpenSSH_8.6, LibreSSL 2.8.3
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0775 for '/etc/ssh/ssh_host_rsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
debug1: Unable to load host key "/etc/ssh/ssh_host_rsa_key": bad permissions
debug1: Unable to load host key: /etc/ssh/ssh_host_rsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0775 for '/etc/ssh/ssh_host_ecdsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
debug1: Unable to load host key "/etc/ssh/ssh_host_ecdsa_key": bad permissions
debug1: Unable to load host key: /etc/ssh/ssh_host_ecdsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0775 for '/etc/ssh/ssh_host_ed25519_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
debug1: Unable to load host key "/etc/ssh/ssh_host_ed25519_key": bad permissions
debug1: Unable to load host key: /etc/ssh/ssh_host_ed25519_key
sshd: no hostkeys available -- exiting.

sudo ssh ::1 -vvv :

OpenSSH_8.6p1, LibreSSL 2.8.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug2: resolve_canonicalize: hostname ::1 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/sava/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/sava/.ssh/known_hosts2'
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug3: ssh_connect_direct: entering
debug1: Connecting to ::1 [::1] port 22.
debug3: set_sock_tos: set socket 3 IPV6_TCLASS 0x48
debug1: Connection established.
debug1: identity file /Users/sava/.ssh/id_rsa type 0
debug1: identity file /Users/sava/.ssh/id_rsa-cert type -1
debug1: identity file /Users/sava/.ssh/id_dsa type -1
debug1: identity file /Users/sava/.ssh/id_dsa-cert type -1
debug1: identity file /Users/sava/.ssh/id_ecdsa type -1
debug1: identity file /Users/sava/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/sava/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/sava/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /Users/sava/.ssh/id_ed25519 type -1
debug1: identity file /Users/sava/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/sava/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/sava/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/sava/.ssh/id_xmss type -1
debug1: identity file /Users/sava/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
kex_exchange_identification: read: Connection reset by peer
Connection reset by ::1 port 22

Comment puis-je réparer cela ? J'ai vraiment besoin de votre aide ! Je suis désespéré :(

0 votes

Vous souvenez-vous de ce que vous avez fait comme commandes pour ce résultat ?

1 votes

Pouvez-vous être plus précis sur les symptômes que vous voyez qui suggèrent que ssh ne fonctionne pas ?

0 votes

@Jean_JD Malheureusement, mais non. Puis-je rétablir les paramètres par défaut ?

2voto

unbeatable101 Points 372

sshd refuse d'utiliser vos clés d'hôte en raison de permissions trop ouvertes, voici les commandes à exécuter pour que les fichiers ssh soient configurés :

sudo chmod 755 /etc/ssh
sudo chmod 644 /etc/ssh/moduli
sudo chmod 644 /etc/ssh/ssh_config
sudo chmod 755 /etc/ssh/ssh_config.d
sudo chmod 600 /etc/ssh/ssh_host*
sudo chmod 644 /etc/ssh/ssh_host*.pub
sudo chmod 644 /etc/ssh/sshd_config
sudo chmod 755 /etc/ssh/sshd_config.d

0voto

nohillside Points 82672

Il y a des choses qui ne vont pas, c'est sûr :

$ ls -ld /etc /etc/ssh* /etc/ssh*/*
lrwxr-xr-x@  1 root  wheel      11 Oct 18 05:30 /etc@ -> private/etc
drwxr-xr-x  19 root  wheel     608 Oct 25 23:38 /etc/ssh/
-rw-r--r--   1 root  wheel  570321 Oct 18 05:30 /etc/ssh/moduli
-rw-r--r--   1 root  wheel    1963 Oct 18 05:30 /etc/ssh/ssh_config
drwxr-xr-x   2 root  wheel      64 Oct 18 05:30 /etc/ssh/ssh_config.d/
-rw-r--r--   1 root  wheel    1624 Jun 27  2015 /etc/ssh/ssh_config~orig
-rw-------   1 root  wheel     672 Oct 23  2013 /etc/ssh/ssh_host_dsa_key
-rw-r--r--   1 root  wheel     590 Oct 23  2013 /etc/ssh/ssh_host_dsa_key.pub
-rw-------   1 root  wheel     227 Jul 21  2015 /etc/ssh/ssh_host_ecdsa_key
-rw-r--r--   1 root  wheel     162 Jul 21  2015 /etc/ssh/ssh_host_ecdsa_key.pub
-rw-------   1 root  wheel     387 Jul 21  2015 /etc/ssh/ssh_host_ed25519_key
-rw-r--r--   1 root  wheel      82 Jul 21  2015 /etc/ssh/ssh_host_ed25519_key.pub
-rw-------   1 root  wheel     965 Oct 23  2013 /etc/ssh/ssh_host_key
-rw-r--r--   1 root  wheel     630 Oct 23  2013 /etc/ssh/ssh_host_key.pub
-rw-------   1 root  wheel    1675 Oct 23  2013 /etc/ssh/ssh_host_rsa_key
-rw-r--r--   1 root  wheel     382 Oct 23  2013 /etc/ssh/ssh_host_rsa_key.pub
-rw-r--r--   1 root  wheel    3523 Oct 18 05:30 /etc/ssh/sshd_config
drwxr-xr-x   4 root  wheel     128 Oct 30 10:38 /etc/ssh/sshd_config.d/
-rw-r--r--   1 root  wheel    4161 Mar 21  2015 /etc/ssh/sshd_config~previous

LesApples.com

LesApples est une communauté de Apple où vous pouvez résoudre vos problèmes et vos doutes. Vous pouvez consulter les questions des autres utilisateurs d'appareils Apple, poser vos propres questions ou résoudre celles des autres.

Powered by:

X