Wednesday, May 29, 2013

Upload a file to FTPES server using CURL

Security is a major concern when transferring file to another server. Nowdays, most of the file transfer is conducted over SSL which adds extra layer of security by encrypting the data. There are two types of such connections are possible.

1. Explicit over TLS server, which is also called FTPES
2. Implicit over TLS server, which is also called FTPS.

In this article, I will demostrate how to use Linux built-in and very powerful utility CURL to connect with FTPES servers.

Here is an example:

curl -T testfile.txt -k -v --ftp-pasv --disable-epsv --ftp-ssl

Lets break down above example to understand how it works.

The first part
is fairly self explanatory, it invokes the curl command.

We then supply the -T option and the file which we want to upload.
-T testfile.txt

We then add an optional -k switch, which ignores any certificate related error.

the -v just used for verbose output so we can see any error which may occur more easily.

--ftp-pasv forces the connection to be made in passive mode. It connects in Active mode by default.

--ftp-ssl or --ssl tries to use SSL/TLS for the connection. It reverts to normal mode if server does not support SSL/TLS

At last but not least, provide your server's FQDN followed by the directory name.

1 comment:

  1. Learn Amazon Web Services for excellent job opportunities from Infycle Technologies, the Excellent AWS Training in Chennai. Infycle Technologies gives the most trustworthy AWS course in Chennai, with full hands-on practical training from professional trainers in the field. Along with that, the placement interviews will be arranged for the candidates, so that, they can meet the job interviews without missing them. To transform your career to the next level, call 7502633633 to Infycle Technologies and grab a free demo to know more