curl ftp:无法连接到 aws 实例

curl ftp:无法连接到 aws 实例

当我尝试在 AWS 机器上通过 curl/ftp 下载文件时,它就挂起了:

$ curl -vvvvv -4 --ftp-pasv ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/ghcnd-stations.txt
*   Trying 205.167.25.101:21...
* TCP_NODELAY set

这是从我的笔记本电脑成功拨打的电话: 这是从我的笔记本电脑成功拨打的电话:

$ curl -vvvvv -4 --ftp-pasv ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/ghcnd-stations.txt > /dev/null
*   Trying 205.167.25.101:21...
* TCP_NODELAY set
* Connected to ftp.ncdc.noaa.gov (205.167.25.101) port 21 (#0)
< 220 205.167.25.101 FTP server ready
> USER anonymous
< 331 Anonymous login ok, send your complete email address as your password
> PASS [email protected]
< 230-****** WARNING ** WARNING ** WARNING ** WARNING ** WARNING ******
<  ** This is a United States Department of Commerce computer     **
<  ** system, which may be accessed and used only for             **
<  ** official Government business by authorized personnel.       **
<  ** Unauthorized access or use of this computer system may      **
<  ** subject violators to criminal, civil, and/or administrative **
<  ** action.  All information on this computer system may be     **
<  ** intercepted, recorded, read, copied, and disclosed by and   **
<  ** to authorized personnel for official purposes, including    **
<  ** criminal investigations.  Access or use of this computer    **
<  ** system by any person, whether authorized or unauthorized,   **
<  ** constitutes consent to these terms.                         **
<  ****** WARNING ** WARNING ** WARNING ** WARNING ** WARNING ******
< 230 Anonymous access granted, restrictions apply
> PWD
< 257 "/" is the current directory
* Entry path is '/'
> CWD pub
* ftp_perform ends with SECONDARY: 0
< 250 CWD command successful
> CWD data
< 250 CWD command successful
> CWD ghcn
< 250 CWD command successful
> CWD daily
< 250 CWD command successful
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||63007|)
*   Trying 205.167.25.101:63007...
* TCP_NODELAY set
* Connecting to 205.167.25.101 (205.167.25.101) port 63007
* Connected to ftp.ncdc.noaa.gov (205.167.25.101) port 21 (#0)
> TYPE I
< 200 Type set to I
> SIZE ghcnd-stations.txt
< 213 9897052
> RETR ghcnd-stations.txt
< 150 Opening BINARY mode data connection for ghcnd-stations.txt (9897052 bytes)
* Maxdownload = -1
* Getting file with size: 9897052
* Remembering we are in dir "pub/data/ghcn/daily/"
< 226 Transfer complete
* Connection #0 to host ftp.ncdc.noaa.gov left intact

此外,从 AWS 实例中,我可以对 http 服务执行标准 curl 调用。以下是 AWS 框中的一个示例,显示了它的工作原理:

$ curl -L -s -o /dev/null -w "%{http_code}\n" google.com
200

我没有打开客户端端口 20 和 21,而我的系统管理员告诉我需要打开它们(并且企业不会打开它们)。

关于超级用户的另一个似乎相关的问题在这里,但尚未得到解答:

无法从 AWS 实例连接到 FTP 服务器

我该如何让它工作?为了让它工作,我是否需要打开本地端口 20 和/或 21?

相关内容