Mac OS ssh:连接被对等方重置

Mac OS ssh:连接被对等方重置

为了使用 Hadoop,我编辑了主机文件并删除了一些行(这些行干扰了正确的操作)。运行时ssh localhost,遇到错误:

kex_exchange_identification: read: Connection reset by peer

配置:

  • hosts.allow
    sshd : ALL
    ALL : ALL
    
  • hosts.deny
    sshd: ALL
    
  • hosts
    ##
    # 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
    
  • 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
    

如何解决这个问题?我真的需要你的帮助!我很绝望 :(

答案1

您已经破坏了(至少)中文件的权限/etc,这就是ssh不再工作的原因。以下是您在问题中列出的文件的正确设置:

lrwxr-xr-x@  1 root  wheel      11  1 Jan  2020 /etc -> private/etc
drwxr-xr-x  13 root  wheel     416 22 Nov 12:22 /etc/ssh
-rw-r--r--   1 root  wheel  577388  1 Jan  2020 /etc/ssh/moduli
-rw-r--r--   1 root  wheel    1511  1 Jan  2020 /etc/ssh/ssh_config
-rw-------   1 root  wheel     672 18 Jun  2018 /etc/ssh/ssh_host_dsa_key
-rw-r--r--   1 root  wheel     590 18 Jun  2018 /etc/ssh/ssh_host_dsa_key.pub
-rw-------   1 root  wheel     227 18 Jun  2018 /etc/ssh/ssh_host_ecdsa_key
-rw-r--r--   1 root  wheel     162 18 Jun  2018 /etc/ssh/ssh_host_ecdsa_key.pub
-rw-------   1 root  wheel     387 18 Jun  2018 /etc/ssh/ssh_host_ed25519_key
-rw-r--r--   1 root  wheel      82 18 Jun  2018 /etc/ssh/ssh_host_ed25519_key.pub
-rw-------   1 root  wheel    1679 18 Jun  2018 /etc/ssh/ssh_host_rsa_key
-rw-r--r--   1 root  wheel     382 18 Jun  2018 /etc/ssh/ssh_host_rsa_key.pub
-rw-r--r--   1 root  wheel    3169  1 Jan  2020 /etc/ssh/sshd_config

我怀疑您可能更改了比这些更多的权限。

不幸的是,我发现关于纠正系统文件权限的正确方法存在冲突且不清楚的文档,因此我建议您访问https://apple.stackexchange.com/并查看之前是否已在那里询问并回答了有关修复权限的问题。 (您不需要具体询问如何修复ssh- 一旦您修复了权限,问题就会得到解决。)

相关内容