다음을 사용하여 ftp 서버에서 파일을 다운로드하려고합니다 curl
.
curl --user kshitiz:pAssword ftp://@11.111.11.11/myfile.txt -o /tmp/myfile.txt -v
curl
서버에 연결하고 멈 춥니 다.
* Hostname was NOT found in DNS cache
* Trying 11.111.11.11...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 11.111.11.11 (11.111.11.11) port 21 (#0)
< 220-You Are Attempting To Access a Private
< 220-Network. Unauthorized Access is Strictly
< 220-Forbidden. Violators Will be Prosecuted!
< 220-- Management
< 220 This is a private system - No anonymous login
> USER kshitiz
< 331 User kshitiz OK. Password required
> PASS pAssword
< 230-OK. Current directory is /
< 230 4432718 Kbytes used (54%) - authorized: 8192000 Kb
> PWD
< 257 "/" is your current location
* Entry path is '/'
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0> EPSV
* Connect data stream passively
* ftp_perform ends with SECONDARY: 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0< 229 Extended Passive mode OK (|||10653|)
* Hostname was NOT found in DNS cache
* Trying 11.111.11.11...
* Connecting to 11.111.11.11 (11.111.11.11) port 10653
0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0* Connected to 11.111.11.11 (11.111.11.11) port 21 (#0)
> TYPE A
0 0 0 0 0 0 0 0 --:--:-- 0:04:02 --:--:-- 0^C
ftp
그러나 파일 연결 및 가져 오기는 다음과 같이 작동합니다.
Status: Connecting to 11.1.1.11:21...
Status: Connection established, waiting for welcome message...
Response: 220-You Are Attempting To Access a Private
Response: 220-Network. Unauthorized Access is Strictly
Response: 220-Forbidden. Violators Will be Prosecuted!
Response: 220-- Management
Response: 220 This is a private system - No anonymous login
Command: USER kshitiz
Response: 331 User kshitiz OK. Password required
Command: PASS ******
Response: 230-OK. Current directory is /
Response: 230 4432718 Kbytes used (54%) - authorized: 8192000 Kb
Status: Server does not support non-ASCII characters.
Status: Connected
Status: Starting download of /myfile.txt
Command: CWD /
Response: 250 OK. Current directory is /
Command: PWD
Response: 257 "/" is your current location
Command: TYPE I
Response: 200 TYPE is now 8-bit binary
Command: PASV
Response: 227 Entering Passive Mode (10,9,4,66,39,139)
Command: RETR myfile.txt
Response: 150 Accepted data connection
Response: 226-File successfully transferred
Response: 226 0.000 seconds (measured here), 3.39 Kbytes per second
Status: File transfer successful, transferred 1 B in 1 second
TYPE A
명령을 어떻게 처리 합니까? ftp가 작동하는데 왜 curl이 작동하지 않습니까?
--disable-epsv
스위치를 추가 하면 문제가 해결되었습니다.
약간의 설명 :
나는 이상한 FTP 문제를 파악하기 위해 많은 시간을 보냈습니다. 문제가 발생한 방식은 로그인 후 FTP 클라이언트가 디렉터리 목록 (또는 다른 명령)을 시도 할 때 중단된다는 것입니다. EPSV는 "확장 수동 모드"이며 FTP의 과거 수동 모드 (PASV)에 대한 최신 확장입니다. 가장 최근의 FTP 클라이언트는 먼저 EPSV를 시도한 다음 실패 할 경우에만 기존 PASV를 사용합니다. ... 방화벽이 EPSV를 차단하는 경우 클라이언트는 명령이 성공한 것으로 간주하고 [ 계속 응답을 기다 립니다].
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다