【问题标题】:scp to a remote server; ssh: connect to host server@address.it port 22: Connection timed outscp 到远程服务器; ssh:连接到主机 server@address.it 端口 22:连接超时
【发布时间】:2021-01-16 03:31:55
【问题描述】:

我在使用 scp 命令复制远程服务器中的某些文件时遇到了一些麻烦。

我在终端上写的那一行是

scp file.dat server@address.it:home/folder

大约一分钟后,它说连接由于超时而丢失

使用选项-vvv 我明白了

Executing: program /usr/bin/ssh host server@address.it, user username, command scp -v -t home/folder
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "server@address.it" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to server@address.it [141.108.1.185] port 22.
debug1: connect to address 141.108.1.185 port 22: Connection timed out
ssh: connect to host server@address.it port 22: Connection timed out
lost connection

在网上搜索,我发现这个问题最常见的来源是防火墙,但我检查了它们,似乎它们没问题。确实有

sudo ufw status
Stato: attivo

A                          Azione      Da
-                          ------      --
22/tcp                     ALLOW       Anywhere                  
22                         ALLOW       Anywhere                  
22/tcp (v6)                ALLOW       Anywhere (v6)             
22 (v6)                    ALLOW       Anywhere (v6)             

最后一条信息,如果我尝试使用 ssh 从我的 PC 终端访问远程服务器,没有问题,并且我已经完成了创建文件夹等简单操作(现在不多了,因为我有将一些数据从我的 PC 复制到该服务器以进行处理)

【问题讨论】:

    标签: shell ssh remote-access remote-server scp


    【解决方案1】:

    正如您所说,通常超时意味着源和目标之间的网络或通信问题。我会跑:

    在源服务器中

    Windows --> CMD --> tracert -h 30 -w 60 -4 IPaddressOFTarget
    Linux   --> Terminal --> traceroute -4 -w 30 IPaddressOFTarget
    

    提供输出。 问候

    【讨论】:

    • 您好,我也遇到了同样的问题。该命令的输出为:traceroute to XXX.XXX.XXX.XXX, 30 hops max, 60 byte packets。有什么想法吗?
    【解决方案2】:

    在 DEBIAN 10 上这工作正常:

    scp -r -P 2222 /DIRFILES remote-user@remote-host:/DIRFILES

    -r 递归 -P 远程端口 DIRFILES 文件夹的绝对路径

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-17
      • 2013-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-23
      • 2022-01-01
      相关资源
      最近更新 更多