title: cURL secure FTP access (--ftp-ssl-control works but --ftp-ssl doesn't)
body: <p>The title of this question hopefully explains the problem, but I'm trying to connect to a remote FTP server using cURL in a shell script I'm currently writing.</p>
  
  <p>On my local machine I'm running this command:</p>
  
  <pre><code>curl --verbose --ftp-ssl -3 --user 'USER:PASS' --disable-epsv ftp://ftp.domain.com:21
  </code></pre>
  
  <p>and after the data connection has been established I see this output:</p>
  
  <pre><code>&lt; 230 User USER logged in
  &gt; PBSZ 0
  &lt; 200 PBSZ 0 successful
  &gt; PROT P
  &lt; 200 Protection set to Private
  &gt; PWD
  &lt; 257 "/" is the current directory
  * Entry path is '/'
  &gt; PASV
  * Connect data stream passively
  &lt; 227 Entering Passive Mode (000,000,000,000,206,106).
  *   Trying 000.000.000.000... connected
  * Connecting to 000.000.000.000 (000.000.000.000) port 52842
  &gt; TYPE A
  &lt; 200 Type set to A
  &gt; LIST
  &lt; 150 Opening ASCII mode data connection for file list
  * Doing the SSL/TLS handshake on the data stream
  * SSL re-using session ID
  * SSLv3, TLS handshake, Client hello (1):
  * SSLv3, TLS handshake, Server hello (2):
  * 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 DHE-RSA-AES256-SHA
  * Server certificate:
  * Maxdownload = -1
  drwxr-xr-x   2 myserver 29894        4096 May 11 17:52 .
  drwxr-xr-x   2 myserver 29894        4096 May 11 17:52 ..
  * SSLv3, TLS alert, Client hello (1):
  * Remembering we are in dir ""
  * SSLv3, TLS alert, Client hello (1):
  &lt; 226 Transfer complete
  * Connection #0 to host ftp.domain.com left intact
  &gt; QUIT
  &lt; 221 Goodbye.
  * Closing connection #0
  * SSLv3, TLS alert, Client hello (1):
  </code></pre>
  
  <p>Running the same command on the server gives me this instead:</p>
  
  <pre><code>&lt; 230 User USER logged in
  &gt; PBSZ 0
  &lt; 200 PBSZ 0 successful
  &gt; PROT P
  &lt; 200 Protection set to Private
  &gt; PWD
  &lt; 257 "/" is the current directory
  * Entry path is '/'
  &gt; EPSV
  * Connect data stream passively
  &lt; 229 Entering Extended Passive Mode (|||49727|)
  *   Trying 2a01:3b0:1:a0::1:2... connected
  * Connecting to 2a01:3b0:1:a0::1:2 (2a01:3b0:1:a0::1:2) port 49727
  &gt; TYPE A
  &lt; 200 Type set to A
  &gt; LIST
  &lt; 150 Opening ASCII mode data connection for file list
  * Doing the SSL/TLS handshake on the data stream
  *   CAfile: /etc/pki/tls/certs/ca-bundle.crt
    CApath: none
  * SSL connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA
  * Server certificate:
  * Maxdownload = -1
  * Remembering we are in dir ""
  &lt; 425 Unable to build data connection: Operation not permitted
  * server did not report OK, got 425
  * Connection #0 to host ftp.domain.com left intact
  curl: (18) server did not report OK, got 425
  &gt; QUIT
  &lt; 221 Goodbye.
  * Closing connection #0
  </code></pre>
  
  <p>If I use the --ftp-ssl-control switch it works on the server, but I want to encrypt the data transfer as well as the authentication.</p>
  
  <p>Does anyone know what the way to resolve this is please? I can't work out if this is a problem with the firewall on the server or to do with the SSL connection and/or the session management - I've tried using the --no-sessionid and --sessionid options but it didn't make any difference, and I get the same results whether I'm using an active or passive connection.</p>
  
  <p>Thanks in advance!</p>