lftp an alternative for rsync under FTP protocol

lftp an alternative for rsync under FTP protocol

Whats up Debian-PB Users,

help of lftp from InfoTech News

Yes! This is true! Its not a click bite, the lftp is a amazing tool that made possible you synchronize a entire folder or just some files using an remote ftp account.


sudo apt-get install lftp

After you install it you can console under lftp cmd line, its very similar of ftp>;

/iandrade# lftp
lftp :~>;

Lets take a look on version:

lftp :~>; version
LFTP | Versão 4.8.4 | Direitos Autorais (c) 1996-2017 Alexander V. Lukyanov
LFTP é software livre: você pode redistribui-lo e ou modificá-lo
sob os termos da GNU General Public License como publicada
pela Free Software Foundation, tanto na versão 3 da Licensa, ou
(na sua opnião) alguma versão posterior.
Este programa é distribuído na esperança de que seja útil, mas
SEM QUALQUER GARANTIA; sem mesmo a garantia implícita de
Veja a GNU General Public License para mais detalhes.
Você deve ter recebido uma cópia da GNU General Public License
juntamente com o LFTP. Se não, veja <http://www.gnu.org/licenses/>;.
Envie relatório de bugs e questões para a lista de e-mail <lftp@uniyar.ac.ru>;.
Bibliotecas usadas: GnuTLS 3.6.13, idn2 2.2.0, Readline 8.0, zlib 1.2.11
lftp :~>;

First Steps

Now lets try connect on FTP with password:

lftp ftp://[email protected]

Put command for send files for the root directory of this ftp user or specify for where you want it go:

lftp rhodanx@debian-pb.org:~>; put file2020

I can check now if the file is there:

lftp rhodanx@debian-pb.org:~>; put file2020
-rw------- 1 1000 1000 0 Dec 01 12:13 file2020

Tricks and Tips

Now the magic, i wanna synchronize everything in folder ‘/home/zoroca/’ into destination on ftp ‘beyer/’ using the option -R means reverse, so its Source(local machine) and destination(ftp account server)

mirror -R /home/zoroca/ beyer/"

Remember, that i am using the console and totally user friendly, but if i need uses just an command for sometype of script auto?

lftp -c "open -u rhodanx,MYPASSWORDHERE debian-pb.org; mirror -R /home/zoroca/ beyer/"

Remember always to set at final of directory the / for it not copy a new directory from current.

Okay, but if i have an private.key ssh for connection under sftp? Because its seens more secure? No problems, we just will need open console with $ lftp and type this for configure the key on the machine:

set sftp:connect-program "ssh -a -x -i /home/tmp/pvt.key"

Now i can use command line normally ignoring password with:

lftp -c "open -u root,ignoreme sftp://debian-pb.org:2202; mirror -R /home/zoroca beyer/"

If you see on examples above, i was just used reverse mirroring option from mirror, but i can use it without reversing, just mirroring like it:

lftp -e 'mirror . /home/debianrulez/' -u debian-pb,PASSWORDHERE ftp://debian-pb.org

So everything at /home/debianrulez will be copied for . at my local machine.

Downloading a website, because yes, the lftp supports http:

lftp -e "mirror -c" http://debian-pb.org

Another commands

  • lpwd – see my current dir
  • lcd – change directory
  • pget – download a file from destination ftp server

Manual Page

The full man page of lftp:


an IT & Infosec Expert, regex pro player and devops skills to made everything happens fast.

Deixe uma resposta