Don’t know what lftp is? Look here. (it’s only the most feature rich, fastest, most epic file transfer program for linux:)

So lftp is a little tricky when trying to use it in scripts etc.. since its meant as an interactive ftp application/client. However, it is possible to use it with one command and also to utilize ssh keys. Here’s an example:

lftp -u username,placeholder -e "set sftp:connect-program 'ssh -a -x -i /home/username/id_rsa.alt'; mirror -L --use-pget-n=5 --parallel=5 /srv/src/ /mnt/dest/; quit" sftp://awesomebox.com:1234

Above, I utilize a ssh key sitting in my home dir, ensure i have at least something for the password field, dereference symlinks (meaning to follow them), enable segmenting for up to 5 pieces at a time, and enable parallel downloading of 5 items at once. This maxes out my home connection…and I mean MAX. You may want to play around with pget and parallel settings to get the best perf depending on your setup.

Also note you can use a ~/.lftprc file OR a ~/.lftp/rc file to specify more options (like I did with the set sftp:connect-program thing, that could actually reside in a file).
Here’s some more on the config file.

And here are some more useful pages on lftp:

https://whatbox.ca/wiki/lftp

http://www.cyberciti.biz/tips/linux-unix-download-accelerator.html

http://www.cyberciti.biz/faq/lftp-mirror-example/

Blog Logo

Mario Loria


Published

Image

./scriptthe.net

Because 127.0.0.1 gets old after a while.

Back to Overview