lftp is an ftp client under Linux for logging in to a remote FTP server. Use its mirror command to back up local files to a remote FTP server via lftp.
If there is no lftp command, you need to install it first:
yum install lftp
1, lftp login lftp login common format: lftp [-d] [-e cmd] [ ,null,null,3],-p port] [-u user[,pass]] [site]
[-d]Run in debug mode.
[-e cmd] Executes the specified command.
[-p port] specifies the connection port.
[-u user[,pass]] login username and password.
[site]FTP server address. For example: lftp -p 21 -u admin,123456 ftp.aaa.com means to use the username admin and password 123456 to log in to the ftp.aaa.com site, the port is 21.
Simple format: lftp user:password@site:port
For example: lftp admin:[email protected]:21 can also be logged in.
There are the same ftp internal commands as the other ftp tools on the command line. After logging in, type help to view the supported commands.
2, lftp mirror command lftp login success, use the mirror command to backup files.
Back up files on remote server to local: mirror [options] [remote directory] [local directory]
Back up local files to remote server: mirror -R [other options] [Local Directory] [Remote Directory]
Common Options: -c, --continue : If the connection is interrupted during the mirroring process, restart. -e, --delete : Delete local files that are not on the remote server. -n, --only-newer : Download new files on the remote server and cannot be used with -c. -R, --reverse : Transfer local file images to a remote server. -v, --verbose[=level] : Set the monitoring level, range 0-3, 0 means no output, 3 means output all.
Example: mirror -R --delete --only-newer --verbose /home/aaa.com /public_html/web/aaa.comBack up the files in the local /home/aaa.com directory to Remote server /public_html /web /aaa.com directory.
mirror --delete --only-newer --verbose /public_html/web /tmp Backs up files from the /public_html/web directory on the remote server to the local /tmp directory.
3, a command to achieve lftp login and mirror use lftp -e option, for example: lftp -e "mirror -R --delete --only-newer --verbose /home/aaa.com /Public_html/web/aaa.com" -p 21 -u admin,123456 ftp.aaa.com automatically executes the -e option after logging in.
Note: If the remote FTP server is Pure-FTPd [privsep] [TLS], the command will be issued: Certificate verification: Not trustedWARNING: Certificate verification: The certificate's owner does not match hostname 'www.xxx. Com' and stay in [Making data connection...], the connection is not available.
You need to edit lftp's /etc/lftp.conf:
vim /etc/lftp.conf
Add at the end:
debug 3set ftp: Ssl-auth TLS-Pset ftp:use-feat no
Try again to see if the details are reported.
PS:lftp uses PASV mode by default. To use PORT mode, execute set ftp:passive off after login, or add it directly to /etc/lftp.conf.
4, lftp multi-threaded download lftp can also be used as a multi-threaded download tool.
Common options: pget -n : Set the number of threads to use. -c : Breakpoint resume.
Example: lftp -c "pget -n 10 http://sourceforge.net/projects/kvm/files/qemu-kvm/1.2.0/qemu-kvm-1.2.0.tar.gz" ;
5, lftp use problem 1) Use lftp's mirror command to backup 550 error rm: Access failed: 550 dirname: Directory not empty
Add at the beginning of the lftp command: set ftp:list -options -a is because there are hidden files under this folder, the server does not display by default, so it cannot be deleted.
2) Set lftp timeout and number of retries at the beginning of the lftp command: set net:timeout 10;set net:max-retries 2;set net:reconnect-interval-base 5;set net:reconnect -interval-multiplier 1;
The final command to synthesize these two points is: lftp -e "set net:timeout 10;set net:max-retries 2;set net:reconnect-interval-base 5; Set net:reconnect-interval-multiplier 1;set ftp:list-options -a;mirror -R --delete --only-newer --verbose /home/aaa.com /public_html/web/aaa.com" -p 21 -u admin,123456 ftp.aaa.com
Before downloading the files on the Linux machine via FTP, upload it after the Windows editing, so
After linux rm deletes the file, recovery is more troublesome. Even if it is restored, the file na
The Go language (ie Golang) is a programming language originally developed by Google. It has severa
A flash drive is one of the most useful tools a person can have. With it, you can back up critical d
Linux limits the external connection port modification
Shell script recursive function - traverse each directory to operate
PC and NB running the lowest processing of modern desktop Linux
Linux Memory Management Knowledge
Linux prompt No such file or directory solution
Linux often crashes, stuck, what should I do?
Linux operating system process knowledge
What is the relationship between Linux and GNU?
Connect the USB flash drive to the VMware virtual machine Tutorial
How to install win8? Win8 installation tutorial graphic analysis (1)
Windows Vista installation and disaster recovery
Maxthon utility plug-in alarm clock articles
Win7 game can not be full screen solution three cases [Photos]
Completely solve the problem that WMC can't play RMVB under Vista.
Three server load balancing user classification
How to shield Win key in Win10 system? How to disable the start button?
Win10 IE can not be used solution