lftp(1) -- Linux man page
NAMElftp - Sophisticated file transfer program
SYNTAXlftp [-d] [-e cmd] [-p port] [-u user[,pass]] [site]
lftp -f script_file
lftp -c commands
VERSIONThis man page documents lftp version 3.0.4.
DESCRIPTIONlftp is a file transfer program that allows sophisticated ftp, http and other connections to other hosts. If site is specified then lftp will connect to that site otherwise a connection has to be established with the open command.
lftp can handle seven file access methods - ftp, ftps, http, https, hftp, fish, sftp and file (https and ftps are only available when lftp is compiled with openssl library). You can specify the method to use in `open URL' command, e.g. `open http://www.us.kernel.org/pub/linux'. hftp is ftp-over-http-proxy protocol. It can be used automatically instead of ftp if ftp:proxy is set to `http://proxy[:port]'. Fish is a protocol working over an ssh connection to a unix account. SFtp is a protocol implemented in ssh2 as sftp subsystem.
Every operation in lftp is reliable, that is any not fatal error is ignored and the operation is repeated. So if downloading breaks, it will be restarted from the point automatically. Even if ftp server does not support REST command, lftp will try to retrieve the file from the very beginning until the file is transferred completely.
lftp has shell-like command syntax allowing you to launch several commands in parallel in background (&). It is also possible to group commands within () and execute them in background. All background jobs are executed in the same single process. You can bring a foreground job to background with ^Z (c-z) and back with command `wait' (or `fg' which is alias to `wait'). To list running jobs, use command `jobs'. Some commands allow redirecting their output (cat, ls, ...) to file or via pipe to external command. Commands can be executed conditionally based on termination status of previous command (&&, ||).
If you exit lftp when some jobs are not finished yet, lftp will move itself to nohup mode in background. The same happens when you have a real modem hangup or when you close an xterm.
lftp has builtin mirror which can download or update a whole directory tree. There is also reverse mirror (mirror -R) which uploads or updates a directory tree on server. Mirror can also synchronize directories between two remote servers, using FXP if available.
There is command `at' to launch a job at specified time in current context, command `queue' to queue commands for sequential execution for current server, and much more.
On startup, lftp executes /etc/lftp.conf and then ~/.lftprc and ~/.lftp/rc. You can place aliases and `set' commands there. Some people prefer to see full protocol debug, use `debug' to turn the debug on. Use `debug 3' to see only greeting messages and error messages.
lftp has a number of settable variables. You can use `set -a' to see all variables and their values or `set -d' to see list of defaults. Variable names can be abbreviated and prefix can be omitted unless the rest becomes ambiguous.
If lftp was compiled with ssl support, then it includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)
! shell command
Launch shell or shell command.
To do a directory listing of the local host.
alias [name [value]]
Define or undefine alias name. If value is omitted, the alias is undefined, else it takes the value value. If no argument is given the current aliases are listed.
alias dir ls -lF alias less zmore
Sets the user to anonymous. This is the default.
at time [ -- command ]
Wait until the given time and execute given (optional) command. See also at(1).
The bookmark command controls bookmarks.
add <name> [<loc>] add current place or given location to bookmarks and bind to given name del <name> remove bookmark with name edit start editor on bookmarks file import <type> import foreign bookmarks list list bookmarks (default)
The cache command controls local memory cache. The following subcommands are recognized:
stat print cache status (default) on|off turn on/off caching flush flush cache size lim set memory limit, -1 means unlimited expire Nx set cache expiration time to N seconds (x=s) minutes (x=m) hours (x=h) or days (x=d)
cat outputs the remote file(s) to stdout. (See also more, zcat and zmore)
Change current remote directory. The previous remote directory is stored as `-'. You can do `cd -' to change the directory back. The previous directory for each site is also stored on disk, so you can do `open site; cd -' even after lftp restart.
chmod mode files
Change permission mask on remote files. The mode must be an octal number.
Close idle connections. By default only with the current server, use -a to close all idle connections.
command cmd args...
execute given command ignoring aliases.
debug [-o file] level|off
Switch debugging to level or turn it off. Use -o to redirect the debug output to a file.
echo [-n] string
guess what it does.
exit will exit from lftp or move to background if jobs are active. If no jobs are active, code is passed to operating system as lftp's termination status. If code is omitted, the exit code of last command is used.
`exit bg' forces moving to background when cmd:move-background is false.
Alias for `wait'.
List files in the directory (current directory by default) recursively. This can help with servers lacking ls -R support. You can redirect output of this command.
Obsolete. Use one of the following instead:
get ftp://... -o ftp://... get -O ftp://... file1 file2... put ftp://... mput ftp://.../* mget -O ftp://... ftp://.../*or other combinations to get FXP transfer (directly between two ftp servers). lftp would fallback to plain copy (via client) if FXP transfer cannot be initiated or ftp:use-fxp is false.
get [-E] [-a] [-c] [-O base] rfile [-o lfile] ...
Retrieve the remote file rfile and store it as the local file lfile. If -o is omitted, the file is stored to local file named as base name of rfile. You can get multiple files by specifying multiple instances of rfile [and -o lfile]. Does not expand wildcards, use mget for that.
-c continue, reget -E delete source files after successful transfer -a use ascii mode (binary is the default) -O <base> specifies base directory or URL where files should be placed
get README get README -o debian.README get README README.mirrors get README -o debian.README README.mirrors -o debian.mirrors get README -o ftp://some.host.org/debian.README get README -o ftp://some.host.org/debian-dir/ (end slash is important)
get1 [OPTS] rfile
Transfer a single file. Options:
-o <lfile> destination file name (default - basename of rfile) -c continue, reget -E delete source files after successful transfer -a use ascii mode (binary is the default) --source-region=<from-to> transfer specified region of source file --target-position=<pos> position in target file to write data at
glob [-d] [-a] [-f] command patterns
Glob given patterns containing metacharacters and pass result to given command. E.g. ``glob echo *''.
-f plain files (default) -d directories -a all types
Print help for cmd or if no cmd was specified print a list of available commands.
List running jobs. -v means verbose, several -v can be specified.
Delete specified job with job_no or all jobs. (For job_no see jobs)
Change current local directory ldir. The previous local directory is stored as `-'. You can do `lcd -' to change the directory back.
Print current working directory on local machine.
List remote files. You can redirect output of this command to file or via pipe to external command. By default, ls output is cached, to see new listing use rels or cache flush.
mget [-c] [-d] [-a] [-E] [-O base] files
Gets selected files with expanded wildcards.
-c continue, reget. -d create directories the same as file names and get the files into them instead of current directory. -E delete source files after successful transfer -a use ascii mode (binary is the default) -O <base> specifies base directory or URL where files should be placed
mirror [OPTS] [source [target]]
Mirror specified source directory to local target directory. If target directory ends with a slash, the source base name is appended to target directory name. Source and/or target can be URLs pointing to directories.
-c, --continue continue a mirror job if possible -e, --delete delete files not present at remote site --delete-first delete old files before transferring new ones -s, --allow-suid set suid/sgid bits according to remote site --allow-chown try to set owner and group on files --ignore-time ignore time when deciding whether to download --ignore-size ignore size when deciding whether to download --only-missing download only missing files -n, --only-newer download only newer files (-c won't work) -r, --no-recursion don't go to subdirectories -p, --no-perms don't set file permissions --no-umask don't apply umask to file modes -R, --reverse reverse mirror (put files) -L, --dereference download symbolic links as files -N, --newer-than=SPEC download only files newer than specified time -P, --parallel[=N] download N files in parallel --use-pget[-n=N] use pget to transfer every single file -i RX, --include RX include matching files -x RX, --exclude RX exclude matching files -I GP, --include-glob GP include matching files -X GP, --exclude-glob GP exclude matching files -v, --verbose[=level] verbose operation --log=FILE write lftp commands being executed to FILE --script=FILE write lftp commands to FILE, but don't execute them --just-print, --dry-run same as --script=- --use-cache use cached directory listings --Remove-source-files remove files after transfer (use with caution) -a same as --allow-chown --allow-suid --no-umask
When using -R, the first directory is local and the second is remote. If the second directory is omitted, base name of first directory is used. If both directories are omitted, current local and remote directories are used.
RX is an extended regular expression, just like in egrep(1).
GP is a glob pattern, e.g. `*.zip'.
Include and exclude options can be specified multiple times. It means that a file or directory would be mirrored if it matches an include and does not match to excludes after the include, or does not match anything and the first check is exclude. Directories are matched with a slash appended.
Note that when -R is used (reverse mirror), symbolic links are not created on server, because ftp protocol cannot do it. To upload files the links refer to, use `mirror -RL' command (treat symbolic links as files).
For option --newer-than you can either specify a file or time specification like that used by at(1) command, e.g. `now-7days' or `week ago'. If you specify a file, then modification time of that file will be used.
Verbosity level can be selected using --verbose=level option or by several -v options, e.g. -vvv. Levels are:
0 - no output (default) 1 - print actions 2 - +print not deleted file names (when -e is not specified) 3 - +print directory names which are mirrored
--only-newer turns off file size comparision and uploads/downloads only newer files even if size is different. By default older files are transferred and replace newer ones.
You can mirror between two servers if you specify URLs instead of directories. FXP is used automatically for transfers between ftp servers, if possible.
mkdir [-p] dir(s)
Make remote directories. If -p is used, make all components of paths.
module module [ args ]
Load given module using dlopen(3) function. If module name does not contain a slash, it is searched in directories specified by module:path variable. Arguments are passed to module_init function. See README.modules for technical details.
Same as `cat files | more'. if PAGER is set, it is used as filter. (See also cat, zcat and zmore)
mput [-c] [-d] [-a] [-E] [-O base] files
Upload files with wildcard expansion. By default it uses the base name of local name as remote one. This can be changed by `-d' option.
-c continue, reput -d create directories the same as in file names and put the files into them instead of current directory -E delete source files after successful transfer (dangerous) -a use ascii mode (binary is the default) -O <base> specifies base directory or URL where files should be placed
Same as `glob rm'. Removes specified file(s) with wildcard expansion.
mv file1 file2
Rename file1 to file2.
List remote file names
open [-e cmd] [-u user[,pass]] [-p port] host|url
Select an ftp server.
pget [OPTS] rfile [-o lfile ]
Gets the specified file using several connections. This can speed up transfer, but loads the net heavily impacting other users. Use only if you really have to transfer the file ASAP, or some other user may go mad :) Options:
-n maxconn set maximum number of connections (default 5)
put [-E] [-a] [-c] [-O base] lfile [-orfile]
Upload lfile with remote name rfile. If -o omitted, the base name of lfile is used as remote name. Does not expand wildcards, use mput for that.
-o <rfile> specifies remote file name (default - basename of lfile) -c continue, reput it requires permission to overwrite remote files -E delete source files after successful transfer (dangerous) -a use ascii mode (binary is the default) -O <base> specifies base directory or URL where files should be placed
Print current remote directory.
queue [-n num ] cmd
Add the given command to queue for sequential execution. Each site has its own queue. `-n' adds the command before the given item in the queue. Don't try to queue `cd' or `lcd' commands, it may confuse lftp. Instead do the cd/lcd before `queue' command, and it will remember the place in which the command is to be done. It is possible to queue up an already running job by `queue wait <jobno>', but the job will continue execution even if it is not the first in queue.
`queue stop' will stop the queue, it will not execute any new commands, but already running jobs will continue to run. You can use `queue stop' to create an empty stopped queue. `queue start' will resume queue execution. When you exit lftp, it will start all stopped queues automatically.
`queue' with no arguments will either create a stopped queue or print queue status.
queue --delete|-d [index or wildcard expression]
Delete one or more items from the queue. If no argument is given, the last entry in the queue is deleted.
queue --move|-m <index or wildcard expression> [index]
Move the given items before the given queue index, or to the end if no destination is given.
-q Be quiet. -v Be verbose. -Q Output in a format that can be used to re-queue. Useful with --delete.
> get file &  get file > queue wait 1 > queue get another_file > cd a_directory > queue get yet_another_file
queue -d 3 Delete the third item in the queue. queue -m 6 4 Move the sixth item in the queue before the fourth. queue -m "get*zip" 1 Move all commands matching "get*zip" to the beginning of the queue. (The order of the items is preserved.) queue -d "get*zip" Delete all commands matching "get*zip".
For FTP - send the command uninterpreted. Use with caution - it can lead to unknown remote state and thus will cause reconnect. You cannot be sure that any change of remote state because of quoted command is solid - it can be reset by reconnect at any time.
For HTTP - specific to HTTP action. Syntax: ``quote <command> [<args>]''. Command may be ``set-cookie'' or ``post''.
open http://www.site.net quote set-cookie "variable=value; othervar=othervalue" set http:post-content-type application/x-www-form-urlencoded quote post /cgi-bin/script.cgi "var=value&othervar=othervalue" > local_file
For FISH - send the command uninterpreted. This can be used to execute arbitrary commands on server. The command must not take input or print ### at new line beginning. If it does, the protocol will become out of sync.
open fish://server quote find -name zip
reget rfile [-o lfile]
Same as `get -c'.
Same as `ls', but ignores the cache.
Same as `nlist', but ignores the cache.
repeat [delay] [command]
Repeat the command. Between the commands a delay inserted, by default 1 second. Example:
repeat at tomorrow -- mirror repeat 1d mirror
reput lfile [-o rfile]
Same as `put -c'.
rm [-r] [-f] files
Remove remote files. Does not expand wildcards, use mrm for that. -r is for recursive directory remove. Be careful, if something goes wrong you can lose files. -f supress error messages.
Remove remote directories.
List cached sessions or switch to specified session.
set [var [val]]
Set variable to given value. If the value is omitted, unset the variable. Variable name has format ``name/closure'', where closure can specify exact application of the setting. See below for details. If set is called with no variable then only altered settings are listed. It can be changed by options:
-a list all settings, including default values -d list only default values, not necessary current ones
Execute site command site_cmd and output the result. You can redirect its output.
Sleep given time interval and exit. Interval is in seconds by default, but can be suffixed with 'm', 'h', 'd' for minutes, hours and days respectively. See also at.
Select specified slot or list all slots allocated. A slot is a connection to a server, somewhat like a virtual console. You can create multiple slots connected to different servers and switch between them. You can also use slot:name as a pseudo-URL evaluating to that slot location.
Default readline binding allows quick switching between slots named 0-9 using Meta-0 - Meta-9 keys (often you can use Alt instead of Meta).
source -e command
Execute commands recorded in file file or returned by specified external command.
source ~/.lftp/rc source -e echo help
Stop lftp process. Note that transfers will be also stopped until you continue the process with shell's fg or bg commands.
user URL [pass]
Use specified info for remote login. If you specify an URL with user name, the entered password will be cached so that futute URL references can use it.
Print lftp version.
Wait for specified job to terminate. If jobno is omitted, wait for last backgrounded job.
`wait all' waits for all jobs termination.
Same as cat, but filter each file through zcat. (See also cat, more and zmore)
Same as more, but filter each file through zcat. (See also cat, zcat and more)
On startup, lftp executes ~/.lftprc and ~/.lftp/rc. You can place aliases and `set' commands there. Some people prefer to see full protocol debug, use `debug' to turn the debug on.
There is also a system-wide startup file in /etc/lftp.conf. It can be in different directory, see FILES section.
lftp has the following settable variables (you can also use `set -a' to see all variables and their values):
- bmk:save-passwords (bool)
- save plain text passwords in ~/.lftp/bookmarks on `bookmark add' command. Off by default.
- cmd:at-exit (string)
- the commands in string are executed before lftp exits.
- cmd:csh-history (bool)
- enables csh-like history expansion.
- cmd:default-protocol (string)
- The value is used when `open' is used with just host name without protocol. Default is `ftp'.
- cmd:fail-exit (bool)
- if true, exit when an unconditional (without || and && at begin) command fails.
- cmd:long-running (seconds)
- time of command execution, which is considered as `long' and a beep is done before next prompt. 0 means off.
- cmd:ls-default (string)
- default ls argument
- cmd:move-background (boolean)
- when false, lftp refuses to go to background when exiting. To force it, use `exit bg'.
- cmd:prompt (string)
The prompt. lftp recognizes the following backslash-escaped special
characters that are decoded as follows:
- insert @ if current user is not default
- an ASCII bell character (07)
- an ASCII escape character (033)
- the hostname you are connected to
- the name of the client (lftp)
- current slot name
- the username of the user you are logged in as
- the URL of the remote site (e.g., ftp://g437.ub.gu.se/home/james/src/lftp)
- the version of lftp (e.g., 2.0.3)
- the current working directory at the remote site
- the base name of the current working directory at the remote site
- the character corresponding to the octal number nnn
- a backslash
- skips next character if previous substitution was empty.
- begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
- end a sequence of non-printing characters
- cmd:remote-completion (bool)
- a boolean to control whether or not lftp uses remote completion.
- cmd:verify-host (bool)
- if true, lftp resolves host name immediately in `open' command. It is also possible to skip the check for a single `open' command if `&' is given, or if ^Z is pressed during the check.
- cmd:verify-path (bool)
if true, lftp checks the path given in `cd' command.
It is also possible to skip the check for a single `cd' command if `&' is given,
or if ^Z is pressed during the check.
set cmd:verify-path/hftp://* false cd directory &
- dns:SRV-query (bool)
- query for SRV records and use them before gethostbyname. The SRV records are only used if port is not explicitly specified. See RFC2052 for details.
- dns:cache-enable (bool)
- enable DNS cache. If it is off, lftp resolves host name each time it reconnects.
- dns:cache-expire (time interval)
- time to live for DNS cache entries. It has format <number><unit>+, e.g. 1d12h30m5s or just 36h. To disable expiration, set it to `inf' or `never'.
- dns:cache-size (number)
- maximum number of DNS cache entries.
- dns:fatal-timeout (seconds)
- limit the time for DNS queries. If DNS server is unavailable too long, lftp will fail to resolve a given host name. 0 means unlimited, the default.
- dns:order (list of protocol names)
- sets the order of DNS queries. Default is ``inet inet6'' which means first look up address in inet family, then inet6 and use first matched.
- dns:use-fork (bool)
- if true, lftp will fork before resolving host address. Default is true.
- file:charset (string)
- local character set. It is set from current locale initially.
- fish:connect-program (string)
- the program to use for connecting to remote server. It should support `-l' option for user name, `-p' for port number. Default is `ssh -ax'. You can set it to `rsh', for example.
- fish:shell (string)
- use specified shell on server side. Default is /bin/sh. On some systems, /bin/sh exits when doing cd to a non-existent directory. lftp can handle that but it has to reconnect. Set it to /bin/bash for such systems if bash is installed.
- ftp:acct (string)
- Send this string in ACCT command after login. The result is ignored. The closure for this setting has format user@host.
- ftp:anon-pass (string)
- sets the password used for anonymous ftp access authentication. Default is "-name@", where name is the username of the user running the program.
- ftp:anon-user (string)
- sets the user name used for anonymous ftp access authentication. Default is "anonymous".
- ftp:auto-sync-mode (regex)
- if first server message metches this regex, turn on sync mode for that host.
- ftp:charset (string)
- the character set used by ftp server in requests, replies and file listings. Default is empty which means the same as local. This setting is only used when the server does not support UTF8.
- ftp:client (string)
- the name of ftp client to send with CLNT command, if supported by server. If it is empty, then no CLNT command will be sent.
- ftp:bind-data-socket (bool)
- bind data socket to the interface of control connection (in passive mode). Default is true, exception is the loopback interface.
- ftp:fix-pasv-address (bool)
- if true, lftp will try to correct address returned by server for PASV command in case when server address is in public network and PASV returns an address from a private network. In this case lftp would substitute server address instead of the one returned by PASV command, port number would not be changed. Default is true.
- ftp:fxp-passive-source (bool)
- if true, lftp will try to set up source ftp server in passive mode first, otherwise destination one. If first attempt fails, lftp tries to set them up the other way. If the other disposition fails too, lftp falls back to plain copy. See also ftp:use-fxp.
- ftp:home (string)
- Initial directory. Default is empty string which means auto. Set this to `/' if you don't like the look of %2F in ftp URLs. The closure for this setting has format user@host.
- ftp:list-empty-ok (bool)
- if set to false, empty lists from LIST command will be treated as incorrect, and another method (NLST) will be used.
- ftp:list-options (string)
- sets options which are always appended to LIST command. It can be useful to set this to `-a' if server does not show dot (hidden) files by default. Default is empty.
- ftp:nop-interval (seconds)
- delay between NOOP commands when downloading tail of a file. This is useful for ftp servers which send "Transfer complete" message before flushing data transfer. In such cases NOOP commands can prevent connection timeout.
- ftp:passive-mode (bool)
- sets passive ftp mode. This can be useful if you are behind a firewall or a dumb masquerading router. In passive mode lftp uses PASV command, not the PORT command which is used in active mode. In passive mode lftp itself makes the data connection to the server; in active mode the server connects to lftp for data transfer. Passive mode is the default.
- ftp:port-ipv4 (ipv4 address)
- specifies an IPv4 address to send with PORT command. Default is empty which means to send the address of local end of control connection.
- ftp:port-range (from-to)
- allowed port range for active mode. Format is min-max, or `full' or `any' to indicate any port. Default is `full'.
- ftp:proxy (URL)
- specifies ftp proxy to use. To disable proxy set this to empty string. Note that it is an ftp proxy which uses ftp protocol, not ftp over http. Default value is taken from environment variable ftp_proxy if it starts with ``ftp://''. If your ftp proxy requires authentication, specify user name and password in the URL.
If ftp:proxy starts with http://, hftp (ftp over http proxy) is used instead of ftp automatically.
- ftp:rest-list (bool)
- allow usage of REST command before LIST command. This might be useful for large directories, but some ftp servers silently ignore REST before LIST.
- ftp:rest-stor (bool)
- if false, lftp will not try to use REST before STOR. This can be useful for some buggy servers which corrupt (fill with zeros) the file if REST followed by STOR is used.
- ftp:retry-530 (regex)
- Retry on server reply 530 for PASS command if text matches this regular expression. This setting should be useful to distinguish between overloaded server (temporary condition) and incorrect password (permanent condition).
- ftp:retry-530-anonymous (regex)
- Additional regular expression for anonymous login, like ftp:retry-530.
- ftp:site-group (string)
- Send this string in SITE GROUP command after login. The result is ignored. The closure for this setting has format user@host.
- ftp:skey-allow (bool)
- allow sending skey/opie reply if server appears to support it. On by default.
- ftp:skey-force (bool)
- do not send plain text password over the network, use skey/opie instead. If skey/opie is not available, assume failed login. Off by default.
- ftp:ssl-allow (bool)
- if true, try to negotiate SSL connection with ftp server for non-anonymous access. Default is true. This setting is only available if lftp was compiled with openssl.
- ftp:ssl-force (bool)
- if trus, refuse to send password in clear when server does not support SSL. Default is false. This setting is only available if lftp was compiled with openssl.
- ftp:ssl-protect-data (bool)
- if true, request ssl connection for data transfers. This is cpu-intensive but provides privacy. Default is false. This setting is only available if lftp was compiled with openssl.
- ftp:ssl-protect-fxp (bool)
- if true, request ssl connection for data transfer between two ftp servers in FXP mode. CPSV or SSCN command will be used in that case. If ssl connection fails for some reason, lftp would try unprotected FXP transfer unless ftp:ssl-force is set for any of the two servers. Default is false.
- ftp:ssl-protect-list (bool)
- if true, request ssl connection for file list transfers. Default is true.
- ftp:stat-interval (seconds)
- interval between STAT commands. Default is 1.
- ftp:sync-mode (bool)
- if true, lftp will send one command at a time and wait for response. This might be useful if you are using a buggy ftp server or router. When it is off, lftp sends a pack of commands and waits for responses - it speeds up operation when round trip time is significant. Unfortunately it does not work with all ftp servers and some routers have troubles with it, so it is on by default.
- ftp:timezone (string)
- Assume this timezone for time in listings returned by LIST command. This setting can be GMT offset [+|-]HH[:MM[:SS]] or any valid TZ value (e.g. Europe/Moscow or MSK-3MSD,M3.5.0,M10.5.0/3). The default is GMT. Set it to an empty value to assume local timezone specified by environment variable TZ.
- ftp:use-abor (bool)
- if false, lftp does not send ABOR command but closes data connection immediately.
- ftp:use-feat (bool)
- when true (default), lftp uses FEAT command to determine extended features of ftp server.
- ftp:use-fxp (bool)
- if true, lftp will try to set up direct connection between two ftp servers.
- ftp:use-hftp (bool)
- when ftp:proxy points to an http proxy, this setting selects hftp method (GET, HEAD) when true, and CONNECT method when false. Default is true.
- ftp:lang (bool)
- the language selected with LANG command, if supported as indicated by FEAT response. Default is empty which means server default.
- ftp:use-mdtm (bool)
- when true (default), lftp uses MDTM command to determine file modification time.
- ftp:use-mdtm-overloaded (bool)
- when true, lftp uses two argument MDTM command to set file modification time on uploaded files. Default is false.
- ftp:use-site-idle (bool)
- when true, lftp sends `SITE IDLE' command with net:idle argument. Default is false.
- ftp:use-site-utime (bool)
- when true, lftp sends `SITE UTIME' command to set file modification time on uploaded files. Default is true.
- ftp:use-size (bool)
- when true (default), lftp uses SIZE command to determine file size.
- ftp:use-stat (bool)
- if true, lftp sends STAT command in FXP mode transfer to know how much data has been transferred. See also ftp:stat-interval. Default is true.
- ftp:use-telnet-iac (bool)
- when true (default), lftp uses TELNET IAC command and follows TELNET protocol as specified in RFC959. When false, it does not follow TELNET protocol and thus does not double 255 (0xFF, 0377) character and does not prefix ABOR and STAT commands with TELNET IP+SYNCH signal.
- ftp:use-quit (bool)
- if true, lftp sends QUIT before disconnecting from ftp server. Default is true.
- ftp:verify-address (bool)
- verify that data connection comes from the network address of control connection peer. This can possibly prevent data connection spoofing which can lead to data corruption. Unfortunately, this can fail for sertain ftp servers with several network interfaces, when they do not set outgoing address on data socket, so it is disabled by default.
- ftp:verify-port (bool)
- verify that data connection has port 20 (ftp-data) on its remote end. This can possibly prevent data connection spoofing by users of remote host. Unfortunately, too many windows and even unix ftp servers forget to set proper port on data connection, thus this check is off by default.
- ftp:web-mode (bool)
- disconnect after closing data connection. This can be useful for totally broken ftp servers. Default is false.
- hftp:cache (bool)
- allow server/proxy side caching for ftp-over-http protocol.
- hftp:proxy (URL)
- specifies http proxy for ftp-over-http protocol (hftp). The protocol hftp cannot work without a http proxy, obviously. Default value is taken from environment variable ftp_proxy if it starts with ``http://'', otherwise from environment variable http_proxy. If your ftp proxy requires authentication, specify user name and password in the URL.
- hftp:use-authorization (bool)
- if set to off, lftp will send password as part of URL to the proxy. This may be required for some proxies (e.g. M-soft). Default is on, and lftp will send password as part of Authorization header.
- hftp:use-head (bool)
- if set to off, lftp will try to use `GET' instead of `HEAD' for hftp protocol. While this is slower, it may allow lftp to work with some proxies which don't understand or mishandle ``HEAD ftp://'' requests.
- hftp:use-type (bool)
- If set to off, lftp won't try to append `;type=' to URLs passed to proxy. Some broken proxies don't handle it correctly. Default is on.
- http:accept, http:accept-charset, http:accept-language (string)
- specify corresponding HTTP request headers.
- http:cache (bool)
- allow server/proxy side caching.
- http:cookie (string)
send this cookie to server. A closure is useful here:
set cookie/www.somehost.com "param=value"
- http:post-content-type (string)
- specifies value of Content-Type http request header for POST method. Default is ``application/x-www-form-urlencoded''.
- http:proxy (URL)
- specifies http proxy. It is used when lftp works over http protocol. Default value is taken from environment variable http_proxy. If your proxy requires authentication, specify user name and password in the URL.
- http:put-method (PUT or POST)
- specifies which http method to use on put.
- http:put-content-type (string)
- specifies value of Content-Type http request header for PUT method.
- http:referer (string)
- specifies value for Referer http request header. Single dot `.' expands to current directory URL. Default is `.'. Set to empty string to disable Referer header.
- http:set-cookies (boolean)
- if true, lftp modifies http:cookie variables when Set-Cookie header is received.
- http:user-agent (string)
- the string lftp sends in User-Agent header of HTTP request.
- https:proxy (string)
- specifies https proxy. Default value is taken from environment variable https_proxy.
- mirror:exclude-regex (regex)
- specifies default exclusion pattern. You can override it by --include option.
- mirror:order (list of patterns)
- specifies order of file transfers. E.g. setting this to "*.sfv *.sum" makes mirror to transfer files matching *.sfv first, then ones matching *.sum and then all other files. To process directories after other files, add "*/" to end of pattern list.
- mirror:parallel-directories (boolean)
- if true, mirror will start processing of several directories in parallel when it is in parallel mode. Otherwise, it will transfer files from a single directory before moving to other directories.
- mirror:parallel-transfer-count (number)
- specifies number of parallel transfers mirror is allowed to start. Default is 1. You can override it with --parallel option.
- mirror:use-pget-n (number)
- specifies -n option for pget command used to transfer every single file under mirror. Default is 1 which disables pget.
- module:path (string)
- colon separated list of directories to look for modules. Can be initialized by environment variable LFTP_MODULE_PATH. Default is `PKGLIBDIR/VERSION:PKGLIBDIR'.
- net:connection-limit (number)
- maximum number of concurrent connections to the same site. 0 means unlimited.
- net:connection-takeover (bool)
- if true, foreground connections have priority over background ones and can interrupt background transfers to complete a foreground operation.
- net:idle (seconds)
- disconnect from server after that number of idle seconds.
- net:limit-rate (bytes per second)
- limit transfer rate on data connection. 0 means unlimited. You can specify two numbers separated by colon to limit download and upload rate separately.
- net:limit-max (bytes)
- limit accumulating of unused limit-rate. 0 means unlimited.
- net:limit-total-rate (bytes per second)
- limit transfer rate of all connections in sum. 0 means unlimited. You can specify two numbers separated by colon to limit download and upload rate separately. Note that sockets have receive buffers on them, this can lead to network link load higher than this rate limit just after transfer beginning. You can try to set net:socket-buffer to relatively small value to avoid this.
- net:limit-total-max (bytes)
- limit accumulating of unused limit-total-rate. 0 means unlimited.
- net:max-retries (number)
- the maximum number of sequential retries of an operation without success. 0 means unlimited.
- net:no-proxy (string)
- contains comma separated list of domains for which proxy should not be used. Default is taken from environment variable no_proxy.
- net:persist-retries (number)
- ignore this number of hard errors. Useful to login to buggy ftp servers which reply 5xx when there is too many users.
- net:reconnect-interval-base (seconds)
- sets the base minimal time between reconnects. Actual interval depends on net:reconnect-interval-multiplier and number of attempts to perform an operation.
- net:reconnect-interval-max (seconds)
- sets maximum reconnect interval. When current interval after multiplication by net:reconnect-interval-multiplier reachs this value (or exceeds it), it is reset back to net:reconnect-interval-base.
- net:reconnect-interval-multiplier (real number)
- sets multiplier by which base interval is multiplied each time new attempt to perform an operation fails. When the interval reachs maximum, it is reset to base value. See net:reconnect-interval-base and net:reconnect-interval-max.
- net:socket-bind-ipv4 (ipv4 address)
- bind all IPv4 sockets to specified address. This can be useful to select a specific network interface to use. Default is empty which means not to bind IPv4 sockets, operating system will choose an address automatically using routing table.
- net:socket-bind-ipv6 (ipv6 address)
- the same for IPv6 sockets.
- net:socket-buffer (bytes)
- use given size for SO_SNDBUF and SO_RCVBUF socket options. 0 means system default.
- net:socket-maxseg (bytes)
- use given size for TCP_MAXSEG socket option. Not all operating systems support this option, but linux does.
- net:timeout (seconds)
- sets the network protocol timeout.
- sftp:connect-program (string)
- the program to use for connecting to remote server. It should support `-l' option for user name, `-p' for port number. Default is `ssh -ax'. You can set it to `rsh', for example.
- sftp:max-packets-in-flight (number)
- The maximum number of unreplied packets in flight. If round trip time is significant, you should increase this and size-read/size-write. Default is 3.
- sftp:protocol-version (number)
- The protocol number to negotiate. Default is 4. The actual protocol version used depends on server.
- sftp:server-program (string)
The server program implementing SFTP protocol. If it does not contain a slash `/',
it is considered a ssh2 subsystem and -s option is used when starting connect-program.
Default is `sftp'. You can use rsh as transport level protocol like this:
set sftp:connect-program rsh set sftp:server-program /usr/libexec/openssh/sftp-serverSimilarly you can run sftp over ssh1.
- sftp:size-read (number)
- Block size for reading. Default is 0x8000.
- sftp:size-write (number)
- Block size for writing. Default is 0x8000.
- ssl:ca-file (path to file)
- use specified file as Certificate Authority certificate.
- ssl:ca-path (path to directory)
- use specified directory as Certificate Authority certificate repository.
- ssl:crl-file (path to file)
- use specified file as Certificate Revocation List certificate.
- ssl:crl-path (path to directory)
- use specified directory as Certificate Revocation List certificate repository.
- ssl:key-file (path to file)
- use specified file as your private key.
- ssl:cert-file (path to file)
- use specified file as your certificate.
- ssl:verify-certificate (boolean)
- if set to yes, then verify server's certificate to be signed by a known Certificate Authority and not be on Certificate Revocation List.
- xfer:clobber (bool)
- if this setting is off, get commands will not overwrite existing files and generate an error instead. Default is on.
- xfer:eta-period (seconds)
- the period over which wheighted average rate is calculated to produce ETA.
- xfer:eta-terse (bool)
- show terse ETA (only high order parts). Default is true.
- xfer:max-redirections (number)
- maximum number of redirections. This can be useful for downloading over HTTP. Default is 0, which prohibits redirections.
- xfer:rate-period (seconds)
the period over which wheighted average rate is calculated to be shown.
The name of variables can be abbreviated unless it becomes ambiguous. The prefix before `:' can be omitted too. You can set one variable several times for different closures, and thus you can get a particular settings for particular state. The closure is to be specified after variable name separated with slash `/'.
The closure for `dns:', `net:', `ftp:', `http:', `hftp:' domain variables is currently just the host name as you specify it in the `open' command (with some exceptions where closure is meaningless, e.g. dns:cache-size). For some `cmd:' domain variables the closure is current URL without path. For other variables it is not currently used. See examples in the sample lftp.conf.
Certain commands and settings take a time interval parameter. It has the format Nx[Nx...], where N is time amount and x is time unit: d - days, h - hours, m - minutes, s - seconds. Default unit is second. E.g. 5h30m. Also the interval can be `infinity', `inf', `never', `forever' - it means infinite interval. E.g. `sleep forever' or `set dns:cache-expire never'.
FTP asynchronous mode (pipelining)
Lftp can speed up ftp operations by sending several commands at once and then checking all the responses. See ftp:sync-mode variable. Sometimes this does not work, thus synchronous mode is the default. You can try to turn synchronous mode off and see if it works for you. It is known that some network software dealing with address translation works incorrectly in the case of several FTP commands in one network packet.
RFC959 says: ``The user-process sending another command before the completion reply would be in violation of protocol; but server-FTP processes should queue any commands that arrive while a preceding command is in progress''. Also, RFC1123 says: ``Implementors MUST NOT assume any correspondence between READ boundaries on the control connection and the Telnet EOL sequences (CR LF).'' and ``a single READ from the control connection may include more than one FTP command''.
So it must be safe to send several commands at once, which speeds up operation a lot and seems to work with all Unix and VMS based ftp servers. Unfortunately, windows based servers often cannot handle several commands in one packet, and so cannot some broken routers.
- Switch on debugging mode
- -e commands
- Execute given commands and don't exit.
- -p port
- Use the given port to connect
- -u user[,pass]
- Use the given username and password to connect
- -f script_file
- Execute commands in the file and exit
- -c commands
Execute the given commands and exit
ENVIRONMENT VARIABLESThe following environment variables are processed by lftp:
- Used for (local) tilde (`~') expansion
- Used by the ! command to determine the shell to run.
- This should be the name of the pager to use. It's used by the more and zmore commands.
- http_proxy, https_proxy
- Used to set initial http:proxy, hftp:proxy and https:proxy variables.
- Used to set initial ftp:proxy or hftp:proxy variables, depending on URL protocol used in this environment variable.
- Used to set initial net:no-proxy variable.
Used to set initial module:path variable.
system-wide startup file. Actual location depends on --sysconfdir
configure option. It is /etc when prefix is /usr,
/usr/local/etc by default.
- ~/.lftp/rc, ~/.lftprc
- These files are executed on lftp startup after /etc/lftp.conf.
- The file things are logged to when lftp moves into the background in nohup mode.
- The file is used to store lftp's bookmarks. See the bookmark command.
- The file is used to store last working directories for each site visited.
The file is consulted to get default login and password to ftp server.
Passwords are also searched here if an URL with user name but with no
password is used.
SEE ALSOftpd(8), ftp(1)
RFC854 (telnet), RFC959 (ftp), RFC1123, RFC1945 (http/1.0), RFC2052 (SRV RR), RFC2068 (http/1.1), RFC2228 (ftp security extensions), RFC2389 (ftp FEAT), RFC2428 (ftp/ipv6), RFC2640 (ftp i18n).
http://www.ietf.org/internet-drafts/draft-murray-auth-ftp-ssl-11.txt (ftp over ssl),
http://www.ietf.org/internet-drafts/draft-ietf-ftpext-mlst-16.txt (ftp extensions over RFC959),
Alexander V. Lukyanov email@example.com
ACKNOWLEDGMENTSThis manual page was originally written by Christoph Lameter <firstname.lastname@example.org>, for the Debian GNU/Linux system. The page was improved by Nicolas Lichtmaier <nick@Feedback.com.ar>, James Troup <J.J.Troup@comp.brad.ac.uk> and Alexander V. Lukyanov <email@example.com>.