首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从我的Arco Linux SSH客户端失败

从我的Arco Linux SSH客户端失败
EN

Unix & Linux用户
提问于 2021-01-12 20:48:31
回答 1查看 123关注 0票数 0

我的问题是:我无法从我的Arco连接到外部SSH服务器("Uberspace“和"GitHub"),如果我试图连接到内部SSH服务器,它可以工作,但返回密码身份验证。

我使用以下SSH客户机/服务器进行测试。

  • 本地SSH客户(LinuxPC,MBP,Banana,
  • 本地SSH服务器(Banana (192.168.1.57)和MBP (192.168.1.22))和
  • 用于测试的远程SSH服务器(Uberspace (185.26.156.188)和GitHub)

我做了以下工作:

通过ssh拷贝id将公钥从LinuxPC和MBP传递到Banana,并使用他们的web接口传递到Uberspace和GitHub。ssh-复制id从LinuxPC到Uberspace应该是可能的,但是抛出一个“网络是不可访问的”。

然后,我尝试通过SSH密钥身份验证进行连接,结果如下:

LinuxPC -> MBP:尽管我以前成功地使用ssh-copy-id,但仍会询问密码。密码有效。

LinuxPC -> Banana:尽管我之前成功地使用ssh-copy-id,但仍会询问密码。密码有效。

LinuxPC -> Uberspace:无法连接拒绝连接/网络

LinuxPC -> GitHub:拒绝连接

MBP -> Banana:使用公钥方式确定

MBP -> Uberspace:确定使用公钥auth

MBP -> GitHub:确定使用公钥auth

Banana -> Uberspace (网络不可达,连接被拒绝)

Banana -> MBP (公开密钥处理很好)

Banana -> GitHub (连接被拒绝)

看起来就像..。

  • 外部SSH服务器(Uberspace,GitHub)可以从我的内联网连接到公钥auth (来自MBP)。
  • LinuxPC能够用密码auth ( MBP和Banana)连接到内部服务器。
  • 我不能用公开密钥从LinuxPC获得SSH
  • 我不能从LinuxPC到外部服务器

我的防火墙列表off、LinuxPC和MBP都与相同的路由器(FritzBox)连接。路由器中没有特定的设置,因此对于LinuxPC、MBP和Banana,它的行为应该是相同的。

LinuxPC中的<>ssh_config位于本文末尾。是不是有什么遗漏或错了。我没有改变内容。

任何暗示或指导都是很好的

非常感谢!

详细信息:

Banana -> Uberspace

代码语言:javascript
复制
bananapi@BANANA ~ $ ssh -v xxxnc@elst.uberspace.de
OpenSSH_6.0p1 Debian-4+deb7u2, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to elst.uberspace.de [185.26.156.188] port 22.
debug1: connect to address 185.26.156.188 port 22: Connection refused
debug1: Connecting to elst.uberspace.de [2a00:d0c0:200:0:b9:1a:9c:8e] port 22.
debug1: connect to address 2a00:d0c0:200:0:b9:1a:9c:8e port 22: Network is unreachable
ssh: connect to host elst.uberspace.de port 22: Network is unreachable
代码语言:javascript
复制
bananapi@BANANA ~ $ ssh-copy-id xxxnc@elst.uberspace.de
ssh: connect to host elst.uberspace.de port 22: Network is unreachable
代码语言:javascript
复制
bananapi@BANANA ~ $ nc -vz 95.143.172.245 22
nc: connect to 95.143.172.245 port 22 (tcp) failed: Connection refused
代码语言:javascript
复制
bananapi@BANANA ~ $ nc -vz 185.26.156.188 22
nc: connect to 185.26.156.188 port 22 (tcp) failed: Connection refused

Banana -> MBP (ok)

代码语言:javascript
复制
bananapi@BANANA ~ $ ssh-copy-id xxx@192.168.1.22
Now try logging into the machine, with "ssh 'xxx@192.168.1.22'", and check in:

  ~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.
代码语言:javascript
复制
bananapi@BANANA ~ $ ssh xxx@192.168.1.22
Last login: Tue Jan 12 15:05:18 2021 from 192.168.1.57

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.

LinuxPC -> MBP (仅-只)

代码语言:javascript
复制
[xxx@Linux-PC ~]$ ssh-copy-id xxx@192.168.1.22
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/xxx/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'xxx@192.168.1.22'"
and check to make sure that only the key(s) you wanted were added.
代码语言:javascript
复制
[xxx@Linux-PC ~]$ ssh xxx@192.168.1.22
Enter passphrase for key '/home/xxx/.ssh/id_rsa': 
Password:
Last login: Tue Jan 12 15:34:19 2021 from 192.168.1.54

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
xxxs-MBP:~ xxx$

注意:它要求一个密码,即使我之前上传了一个酒吧密钥。

LinuxPC -> Uberspace

代码语言:javascript
复制
[xxx@Linux-PC ~]$ ssh-copy-id xxxnc@elst.uberspace.de
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/xxx/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: ERROR: ssh: connect to host elst.uberspace.de port 22: Network is unreachable
代码语言:javascript
复制
[xxx@Linux-PC ~]$ ssh -v  xxxnc@elst.uberspace.de
OpenSSH_8.4p1, OpenSSL 1.1.1i  8 Dec 2020
debug1: Reading configuration data /home/xxx/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to elst.uberspace.de [185.26.156.188] port 22.
debug1: connect to address 185.26.156.188 port 22: Connection refused
debug1: Connecting to elst.uberspace.de [2a00:d0c0:200:0:b9:1a:9c:8e] port 22.
debug1: connect to address 2a00:d0c0:200:0:b9:1a:9c:8e port 22: Network is unreachable
ssh: connect to host elst.uberspace.de port 22: Network is unreachable
代码语言:javascript
复制
[xxx@Linux-PC pw]$ nc -vz 95.143.172.245 22
vega.uberspace.de [95.143.172.245] 22 (ssh): Verbindungsaufbau abgelehnt
(means connection rejected)
代码语言:javascript
复制
[xxx@Linux-PC pw]$ nc -vz 185.26.156.188 22
elst.uberspace.de [185.26.156.188] 22 (ssh): Verbindungsaufbau abgelehnt
(means connection rejected)

LinuxPC -> Banana (即使成功上传了pub密钥,仍会询问密码)

代码语言:javascript
复制
[xxx@Linux-PC ~]$ ssh-copy-id -f bananapi@192.168.1.57
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/xxx/.ssh/id_rsa.pub"
Enter passphrase for key '/home/xxx/.ssh/id_rsa': 
bananapi@192.168.1.57's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'bananapi@192.168.1.57'"
and check to make sure that only the key(s) you wanted were added.
代码语言:javascript
复制
[xxx@Linux-PC ~]$ ssh -v bananapi@192.168.1.57
OpenSSH_8.4p1, OpenSSL 1.1.1i  8 Dec 2020
debug1: Reading configuration data /home/xxx/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 192.168.1.57 [192.168.1.57] port 22.
debug1: Connection established.
debug1: identity file /home/xxx/.ssh/id_rsa type 0
debug1: identity file /home/xxx/.ssh/id_rsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_dsa type -1
debug1: identity file /home/xxx/.ssh/id_dsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/xxx/.ssh/id_ed25519 type -1
debug1: identity file /home/xxx/.ssh/id_ed25519-cert type -1
debug1: identity file /home/xxx/.ssh/id_ed25519_sk type -1
debug1: identity file /home/xxx/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/xxx/.ssh/id_xmss type -1
debug1: identity file /home/xxx/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4+deb7u2
debug1: match: OpenSSH_6.0p1 Debian-4+deb7u2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.57:22 as 'bananapi'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: ecdh-sha2-nistp256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes128-ctr MBP: umac-64@openssh.com compression: none
debug1: kex: client->server cipher: aes128-ctr MBP: umac-64@openssh.com compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:q+j2dQzHWPbthWX4VCK4UK7GDwccoGGZZDSBr4Hl4HE
debug1: Host '192.168.1.57' is known and matches the ECDSA host key.
debug1: Found key in /home/xxx/.ssh/known_hosts:1
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: Will attempt key: /home/xxx/.ssh/id_rsa RSA SHA256:XDOacvuprzkByJY1ZpGjZN2anPeYVeNkN7v5P6TuBBw
debug1: Will attempt key: /home/xxx/.ssh/id_dsa 
debug1: Will attempt key: /home/xxx/.ssh/id_ecdsa 
debug1: Will attempt key: /home/xxx/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /home/xxx/.ssh/id_ed25519 
debug1: Will attempt key: /home/xxx/.ssh/id_ed25519_sk 
debug1: Will attempt key: /home/xxx/.ssh/id_xmss 
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/xxx/.ssh/id_rsa RSA SHA256:XDOacvuprzkByJY1ZpGjZN2anPeYVeNkN7v5P6TuBBw
debug1: Server accepts key: /home/xxx/.ssh/id_rsa RSA SHA256:XDOacvuprzkByJY1ZpGjZN2anPeYVeNkN7v5P6TuBBw
Enter passphrase for key '/home/xxx/.ssh/id_rsa': 
debug1: Trying private key: /home/xxx/.ssh/id_dsa
debug1: Trying private key: /home/xxx/.ssh/id_ecdsa
debug1: Trying private key: /home/xxx/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/xxx/.ssh/id_ed25519
debug1: Trying private key: /home/xxx/.ssh/id_ed25519_sk
debug1: Trying private key: /home/xxx/.ssh/id_xmss
debug1: Next authentication method: password
bananapi@192.168.1.57's password: 
debug1: Authentication succeeded (password).
Authenticated to 192.168.1.57 ([192.168.1.57]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
Linux BANANA 3.4.103 #1 SMP PREEMPT Thu Dec 18 13:07:12 CST 2014 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
bananapi@BANANA ~ $ 

MBP -> Uberspace (ok)

代码语言:javascript
复制
xxxs-MBP:~ xxx$ ssh-copy-id -f xxxnc@elst.uberspace.de
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/xxx/.ssh/id_rsa.pub"

Number of key(s) added:        1

Now try logging into the machine, with:   "ssh 'xxxnc@elst.uberspace.de'"
and check to make sure that only the key(s) you wanted were added.
代码语言:javascript
复制
xxxs-MBP:~ xxx$ ssh xxxnc@elst.uberspace.de
Last login: Tue Jan 12 14:21:29 2021 from 212.18.221.64
Welcome to Uberspace 7!

Current version: 7.8.1.0
Manual: https://manual.uberspace.de/en/
Watch out for changes at: https://manual.uberspace.de/en/changelog.html
Follow us on Twitter for updates: https://twitter.com/ubernauten

Is something unclear or does not work as expected?
 => check the server status: https://is.uberspace.online
 => reach out to our team: hallo@uberspace.de
[xxxnc@elst ~]$ 

/etc/ssh/ssh_config

代码语言:javascript
复制
# $OpenBSD: ssh_config,v 1.35 2020/07/17 03:43:42 dtucker Exp $

# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

# Host *
# ForwardAgent no
# ForwardX11 no
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
# UserKnownHostsFile ~/.ssh/known_hosts.d/%k
EN

回答 1

Unix & Linux用户

发布于 2021-01-15 14:41:45

解决了。路由器阻塞了连接。有不同的设置笔记本电脑(Wifi)和个人电脑(局域网),我没有想到。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/628856

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档