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
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.