ssh 客户端无法通过公共 IP 连接

ssh 客户端无法通过公共 IP 连接

我已经在 Raspberry pi 上设置了 ssh 服务器,并将路由器上的 22 端口转发到它。我可以通过本地网络顺利连接到它,我的朋友也可以从他家连接到它。然而,当我尝试

ssh [email protected] -v

我的路由器的外部地址在哪里my.router.ip.address,我得到了

OpenSSH_6.7p1 Ubuntu-5ubuntu1.3, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to XX.XX.XX.XX [XX.XX.XX.XX] port 22.
debug1: Connection established.
debug1: identity file /home/julka/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/julka/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Ubuntu-5ubuntu1.3

最后一行一直挂起,直到我将其Ctrl+C为止,无论我是否允许密码验证。我的~/.ssh.内容:

id_rsa  id_rsa.pub  known_hosts

并且/etc/ssh/ssh_config(无用户配置)

Host *
ForwardX11Trusted yes
RSAAuthentication yes
PasswordAuthentication yes
IdentityFile ~/.ssh/id_rsa
HashKnownHosts yes

我缺少了哪些最基本的东西,导致我无法通过 ssh 进入我的 Raspi?

我甚至尝试julka按照@darent 的建议在我的 ssh 服务器上创建帐户。

编辑:

Pi /etc/ssh/sshd_config/(跳过注释行):

IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

答案1

从 LAN 内部连接到您自己的外部 IP 可能会产生一些奇怪的效果。您应该尝试从其他外部 Internet 访问进行连接(例如移动或通过 VPN)。

这是我上面的评论的答案。

相关内容