Enhanced
Which LFTP?
If you want to use LFTP with FTPS, you might need to compile the package with SSL support yourself. Use the command line to check whether this is necessary by entering the
which lftp
command to determine where LFTP has been installed. After calling
ldd /<path>/<to>/lftp
check its output to see whether one of the lines starts with libssl (Figure 1); for example:
$ ldd /usr/local/bin/lftp | grep ssl
If this is not the case, and you want to use FTPS instead of SFTP, follow the instructions in the "DIY LFTP" box.
DIY LFTP
On Debian, you need to install the following dependencies:
- libgnutls30
- libgcc1
- libreadline-dev
- libssl-dev
- libtinfo5
- libunwind8
- libghc-zlib-dev
Depending on the version of the system you are using, you might need other versions of these packages. If further software is missing, entering ./configure
will usually let you know. Build LFTP as shown below with the usual three-card trick – ./configure
, make
, and make install
– and use ldd
to test your home-grown LFTP version for SSL support.
$ wget http://lftp.yar.ru/ftp/lftp-4.8.0.tar.gz$ tar xfz lftp-4.8.0.tar.gz $ cd lftp-4.8.0 $ ./configure --with-openssl=/usr/lib $ make $ sudo make install $ ldd /usr/local/bin/lftp | grep ssl libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fbe89dbd000)
At system startup, LFTP will search the /etc/lftp.conf
, ~/.lftprc
, and ~/.lftp/rc
files (in that order) for configuration. Directives that you create in the home directory take precedence over the global configuration in the /etc
directory. The instructions always start with set
and follow the
set <Option>:<Switch>[on|off]
scheme.
Practice
For test purposes, it is best to use two local computers that serve as the server and client. LFTP will behave in the same way as if you were using remote servers, but it will be easier to locate sources of problems and errors. Unless you specify otherwise, LFTP uses the SFTP protocol. Ports other than standard port 21 are entered at the end of the connection command in the form :<port>
.
For more feedback, add the -d
(debug information) option to the lftp
call. The -h
(--help
) parameter offers little help when it comes to the application's options. An intelligible version of the LFTP man page can be found on the Lifewire website [3].
To get used to the LFTP shell, first download or upload files from the server. To do this, log on to the server with the lftp <user>@[<FQDN>|<IP>]
command; for example:
lftp ft@192.168.178.123
After the connection is established, you are in the LFTP shell.
The ls
command lists the current directory content on the server. With a preceding exclamation mark (!
), you can redirect the command to the client; !ls
shows the contents of the client's current local working directory (Figure 2). Some commands can be executed with a preceding small l
(ell, for "local") on the client, and other commands can be preceded by either switch. Usage is not completely consistent. To simplify things, you can define command aliases to suit your own requirements.
Up and Down
To upload a file from the client to the server, use the put
command, to which you add the name of the file in question (put <file>
). The -d
parameter used for logging in shows you what is happening in the background in detail. If you want to put the file in a certain directory, go there with the cd
command and then run put
.
Following the same pattern, get
lets you download a file. However, with pget
, LFTP offers an alternative that distributes the data transfer over several parallel connections, thus speeding up the download on servers with slow connections. In practice, you would first change to the directory in which you want to store the downloaded file !cd
or lcd
followed by get <file>
or pget <file>
.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs