ric*_*ick 6 ubuntu ssh ssh-keys
首先,我知道这个问题已经被问了一百万次,我已经阅读了我能找到的所有内容,但仍然无法解决问题。
在全新安装的 Ubuntu 上从我的 mac ssh 连接到我的 Ubuntu 服务器时,我遇到了这个问题(我因为这个问题重新安装了)。
我将 SSH 端口映射到 7070,因为我的 ISP 阻止了 22。
在客户端:
bash: ssh -p 7070 -v me@address.org
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to address.org port 7070.
debug1: Connection established.
debug1: identity file /home/me/.ssh/identity type -1
debug1: identity file /home/me/.ssh/id_rsa type 1
debug1: identity file /home/me/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host
Run Code Online (Sandbox Code Playgroud)
这是我为尝试解决问题所做的工作:
确保我maxstartups
的没问题:
bash: grep MaxStartups /etc/ssh/sshd_config
#MaxStartups 10:30:60
Run Code Online (Sandbox Code Playgroud)
当我运行时telnet localhost
,我得到这个:
telnet localhost
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
Run Code Online (Sandbox Code Playgroud)
当我运行 /usr/sbin/sshd -t
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Run Code Online (Sandbox Code Playgroud)
当我重新生成密钥时
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
Run Code Online (Sandbox Code Playgroud)
我犯了同样的错误。
我很确定这就是问题所在。任何人都可以帮忙吗?
小智 6
我在编辑 /etc/hosts.allow 后立即开始收到此错误。
看看我修复之前和之后。
ALL: 192.168.1 notice no period after 192.168.1
ssh_exchange_identification: Connection closed by remote host
ALL: 192.168.1. see the extra period after 192.168.1.
fred@192.168.1.122's password:
Welcome to Linux Mint 11 Katya (GNU/Linux 2.6.38-8-generic i686)
Run Code Online (Sandbox Code Playgroud)
我能想到的最有可能的事情就是你的authorized_keys文件的所有权,这可以帮助你摆脱你之前没有说过你检查过的地方。检查是否/home/me/.ssh/
为 700,其中的文件为 600(不可组访问)且归“我”所有。尝试-vvv
更详细地解释 ssh 此时到底在做什么。
确保您sshd -t
以 root 身份运行。如果我以用户身份运行它,我会收到“无法打开主机密钥”错误。否则,请确保 /etc/ssh/ssh_host_*_key 为 root:root 和 600,但 .pub 密钥为 root:root 644
我认为在您能够连接到非标准端口之前,selinux 就会抱怨它,但为了以防万一,请检查 /var/log/audit.log 是否启用了 selinux。
归档时间: |
|
查看次数: |
23489 次 |
最近记录: |