(相关:Ubuntu22.04SSH RSA密钥自20.04升级以来无法工作 / SSH和Telnet超时Ubuntu 22.04 lts,但提供的解决方案不起作用)
大家好,
在家里工作。我可以去我的实验室,推到github.com+ssh等.
尽管如此,我在一台新计算机上安装了XUbuntu-22.04,而ssh对这台机器不起作用。
在阅读了Ubuntu22.04SSH RSA密钥自20.04升级以来无法工作之后,我将HostKeyAlgorithms +ssh-rsa和PubkeyAcceptedKeyTypes +ssh-rsa添加到~/.ssh/config和/etc/ssh/sshd_config中,重新启动ssh sudo systemctl restart sshd.service,但仍然无法工作(参见下面)。
我对ssh不太了解,所以我不清楚自己在做什么。
以下是一些产出:
$ openssl version
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
$ cat .ssh/config
Host my.host
PubkeyAcceptedKeyTypes +ssh-rsa
KexAlgorithms +diffie-hellman-group14-sha1
HostKeyAlgorithms +ssh-rsa
$ tail /etc/ssh/sshd_config
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
$ sudo systemctl restart sshd.service
ssh -vvvv -X me@my.host
OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home/me/.ssh/config
debug1: /home/me/.ssh/config line 8: Applying options for my.host
debug3: kex names ok: [diffie-hellman-group14-sha1]
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/me/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/me/.ssh/known_hosts2'
debug2: resolving "my.host" port 22
debug3: resolve_host: lookup my.host:22
debug3: ssh_connect_direct: entering
debug1: Connecting to my.host [IP] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: connect to address IP port 22: Connection timed out
ssh: connect to host my.host port 22: Connection timed out我错过了什么?
<#>编辑
我也尝试在sshd_config + ssh_config中添加值。
Telnet也不能工作。
$ telnet my.host 22
Trying IP...
telnet: Unable to connect to remote host: Connection timed out发布于 2022-11-26 13:38:15
好的,我拿到了解决方案:这个连接被网箱禁止了(但我不明白我为什么要上网.)
试试其他的东西:
$ mtr -bTwn -P 80 -Z 1 185.233.100.113
Start: 2022-11-26T15:00:26+0100
HOST: okazaki Loss% Snt Last Avg Best Wrst StDev
1.|-- 192.168.1.1 0.0% 10 1.5 1.2 0.9 1.7 0.2
2.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
3.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
4.|-- 80.12.192.158 0.0% 10 5.8 6.2 2.5 21.6 6.2
5.|-- 193.252.162.250 0.0% 10 9.9 9.9 9.5 10.4 0.3
6.|-- 81.253.129.186 0.0% 10 10.5 10.4 10.1 10.7 0.2
7.|-- 193.252.137.74 0.0% 10 10.2 20.3 10.0 110.8 31.8
8.|-- 193.251.131.8 0.0% 10 10.7 10.7 10.1 11.0 0.3
9.|-- 81.52.188.22 0.0% 10 10.9 10.5 10.0 11.3 0.4
10.|-- 78.153.231.227 0.0% 10 18.6 18.3 17.4 18.9 0.4
11.|-- 31.172.233.174 0.0% 10 17.7 18.0 17.1 22.4 1.6
12.|-- 5.83.232.2 0.0% 10 17.8 17.9 17.7 18.6 0.3
13.|-- 149.6.44.18 0.0% 10 18.4 18.7 17.9 22.8 1.5
14.|-- 185.233.100.113 0.0% 10 19.0 18.6 18.1 19.0 0.3
$ mtr -bTwn -P 22 -Z 1 185.233.100.113
Start: 2022-11-26T15:00:50+0100
HOST: okazaki Loss% Snt Last Avg Best Wrst StDev
1.|-- 192.168.1.1 0.0% 10 0.6 0.7 0.5 1.0 0.2
2.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0发布于 2022-11-26 06:17:47
telnet: Unable to connect to remote host: Connection timed out此错误意味着无法在本地服务器和远程服务器之间建立连接。您可以使用一些工具来检查是否可以连接到远程服务器上的端口。
如果是这样的话,您应该首先从连接级别检查它。ssh密钥/密码交换尚未启动。
如果您可以从另一个服务器从ssh到my.host,这意味着运行在my.host上的sshd服务是好的。您应该从网络层检查它,以了解为什么此服务器无法连接到它。
它可能与网络防火墙或网络ACL有关。这些规则定义了可以访问服务器的客户端ip地址。像AWS这样的云提供商也有这个特性。
只有在解决了此连接问题后,才能继续。
https://askubuntu.com/questions/1442513
复制相似问题