For variety, let's test using passive mode to upload a file for completeness.
The lftp script isn't very interesting, but let's quickly scan it.
The script is identical to the one used in the
previous demo with two minor changes.
First,
passive mode is enabled so the client will initiate
all TCP sessions with the server.
Second, since this is an upload,
the put operation is specified instead of the get operation.
Time to run the script and perform our secure file upload.
The feature exchange happens first and the client wants to use FTPS,
indicated by the AUTH TLS command.
The server responds and basically says please continue.
Now the server sends its SSL certificate,
which we unconditionally trust,
and the client provides its login credentials using
the secure communications channel.
Following this, we issue the PBSZ and PROT commands, which are specific to FTPS.
You'll note that any time PROT C is issued,
it is either a default option issued right after a login,
or used as a cleanup command after a transfer is complete.
The server enforces SSL transport and commands the client to use private
communications whenever legitimate FTP data traffic is transferred.
You'll always see a PROT P before data is shared.
Everything that follows is regular FTP passive mode, and we can see that the file R3.cfg was successfully uploaded to the server.