Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-11-2011
Registered User
 
Join Date: Nov 2010
Location: Portland OR
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
curl sftp download with CWD command

Hi Folks:

Hoping for some help. I am trying to get a curl command to work that will login via sftp, perform a CWD to 'newfolder' and download a file.

Example of failing script:


Code:
curl -o /tmp/filename --ftp-method singlecwd --ftp-ssl -k ftp://000.000.000.000:20021//newfolder/filename --user username:userpass

The error I am getting is:
curl: (19) RETR response: 550

I'm not quite sure what to make of it. Thanks for any help you can provide. And let me know if I can provide more info!

Using curl version 7.5.3 on HP-UX:

curl 7.15.3 (hppa2.0w-hp-hpux11.11) libcurl/7.15.3 OpenSSL/0.9.7i zlib/1.2.3
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: IPv6 Largefile NTLM SSL libz

---------- Post updated at 04:22 PM ---------- Previous update was at 03:50 PM ----------

Update:

I also tried this alternative method, and got more info on the command. Hopefully this will be more useful in trying to resolve the 550 error.


Code:
  curl --verbose --disable-epsv --retry 6 -o /tmp/filename --ftp-ssl -k --remote-name ftp://000.000.000.000:20021//newfolder/filename --user username:userpass

Output (sanitized for the internet tubes):

About to connect() to 000.000.000.000 port 20021
* Trying 000.135.128.149... connected
* Connected to 000.000.000.000 (000.000.000.000) port 20021
< 220 Welcome to SECRET Data Distribution Services. Time = 18:11:04
> AUTH SSL
< 234 AUTH TLS-P/SSL OK.
* successfully set certificate verify locations:
* CAfile: /opt/iexpress/curl/share/curl/curl-ca-bundle.crt
CApath: none
* SSLv2, Client hello (1):
SSLv3, TLS handshake, Server hello (2):
SSLv3, TLS handshake, CERT (11):
SSLv3, TLS handshake, Server finished (14):
SSLv3, TLS handshake, Client key exchange (16):
SSLv3, TLS change cipher, Client hello (1):
SSLv3, TLS handshake, Finished (20):
SSLv3, TLS change cipher, Client hello (1):
SSLv3, TLS handshake, Finished (20):
SSL connection using DES-CBC3-SHA
* Server certificate:
* subject: /C=US/ST=Minnesota/L=St. Paul/O=SECRET/OU=Data Distribution Services ceweba1u FTPS/CN=this.site.com
* start date: 2009-04-21 00:00:00 GMT
* expire date: 2012-04-20 23:59:59 GMT
* common name: this.site.com (does not match '170.135.128.149')
* issuer: /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)05/CN=VeriSign Class 3 Secure Server CA
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> USER username
< 331 Password required for username.
> PASS userpass
< 230 Connect:Enterprise UNIX login ok, access restrictions apply.
> PBSZ 0
< 200 PBSZ 0 OK.
> PROT P
< 200 PROT P OK, data channel will be secured.
> PWD
< 257 "/defaultfolder" is current directory.
* Entry path is '/defaultfolder'
> CWD /newfolder
< 250 CWD command successful.
> PASV
* Connect data stream passively
< 227 Entering Passive Mode (000,000,000,000,82,8)
* Trying 000.000.000.000... connected
* Connecting to 000.000.000.000 (000.000.000.000) port 21000
> TYPE I
< 200 Type set to I.
> SIZE filename
< 550 Operation is not supported under Connect:Enterprise FTP server.
> RETR filename
< 550 *** ERROR *** NO BATCHES FOR TRANSMISSION
* RETR response: 550
* Remembering we are in dir /newfolder/
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0* Connection #0 to host 000.000.000.000 left intact

curl: (19) RETR response: 550
> QUIT
< 221 Goodbye.
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
Sponsored Links
    #2  
Old 03-14-2011
Registered User
 
Join Date: Nov 2010
Location: Portland OR
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Update:

I feel pretty silly, but my issue is now closed. Evidently, on the target server, there is some logic that makes the file unavailable after a download attempt. Hence my error.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Download using curl and redirect question_please help santod Shell Programming and Scripting 1 03-07-2011 12:49 PM
Shell Script for Upload/download files using cURL Olivia Shell Programming and Scripting 2 01-02-2011 09:15 PM
Use cURL in shell script and get most recent file from remote server using SFTP toobrown1 Shell Programming and Scripting 7 09-10-2009 02:39 PM
Curl command protocomm Shell Programming and Scripting 1 03-26-2009 01:49 AM
cURL Active FTP Download Dallasbr UNIX for Dummies Questions & Answers 2 06-26-2008 11:38 AM



All times are GMT -4. The time now is 01:43 AM.