lftp − Sophisticated file transfer program
[−d] [−e cmd]
[−p port] [−u
lftp −f script_file
lftp −c commands
This man page documents lftp version 4.7.4.
lftp 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 several file access methods - FTP, FTPS, HTTP, HTTPS, HFTP, FISH, SFTP and file (HTTPS and FTPS are only available when lftp is compiled with GNU TLS or 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.
Besides FTP-like protocols, lftp has support for BitTorrent protocol as ’torrent’ command. Seeding is also supported.
Every operation in lftp is reliable, that is any non-fatal error is handled properly and the operation is repeated. So if downloading breaks, it will be restarted from the point automatically. Even if FTP server does not support the 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 before all jobs are not finished yet, lftp will move itself to nohup mode in background. The same thing happens with a real modem hangup or when you close an xterm.
lftp has built-in 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 (or ~/.config/lftp/rc if ~/.lftp does not exist). 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 OpenSSL (configure −−with−openssl) 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
alias less zmore
at time [ −− command ]
Wait until the given time and execute given (optional) command. See also at(1).
Attach the terminal to specified backgrounded lftp process.
The bookmark command controls bookmarks.
Site names can be used in the open command directly as-is or in any command that accepts input URLs using the bm:site/path format.
The cache command controls local memory cache. The following subcommands are recognized:
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.
cls [OPTS] files...
’cls’ tries to retrieve information about specified files or directories and outputs the information according to format options. The difference between ’ls’ and ’cls’ is that ’ls’ requests the server to format file listing, and ’cls’ formats it itself, after retrieving all the needed information.
command cmd args...
execute given command ignoring aliases.
debug [OPTS] level|off
Switch debugging to level or turn it off. Options:
echo [−n] string
Prints (echos) the given string to the display.
edit [OPTS] file
Retrieve remote file to a temporary location, run a local editor on it and upload the file back if changed. Options:
eval [-f format ] args...
without -f it executes given arguments as a command. With -f, arguments are transformed into a new command. The format can contain plain text and placeholders $0...$9 and $@, corresponding to the arguments.
exit [bg] [top] [parent] [kill] [code]
exit will exit from lftp or move to background if there are active jobs. If no job is 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. ’exit top’ makes top level ’shell’ (internal lftp command executor) terminate. ’exit parent’ terminates the parent shell when running a nested script. ’exit kill’ kills all numbered jobs before exiting. The options can be combined, e.g. ’at 08:00 −− exit top kill &’ kills all jobs and makes lftp exit at specified time.
Alias for ’wait’.
find [OPTS] directory...
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. Options:
Obsolete. Use one of the following instead:
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] [−e] [−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.
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:
glob [OPTS] [command] patterns
Glob given patterns containing metacharacters and pass result to given command or return appropriate exit code.
glob echo *
glob --exist *.csv && echo "There are *.csv files"
Print help for cmd or if no cmd was specified print a list of available commands.
jobs [OPTS] [job_no...]
List running jobs. If job_no is specified, only list a job with that number. Options:
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.
ln [−s] existing-file new-link
Make a hard/symbolic link to an existing file. Option −s selects creation of a symbolic link.
Run specified command with local directory file:// session instead of remote session. Examples:
local mirror /dir1 /dir2
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.
mirror [OPTS] [source [target]]
Mirror specified source directory to local target directory. If the target directory ends with a slash (except the root), the source base name is appended to target directory name. Source and/or target can be URLs pointing to directories.
When using −R, the source directory is local and the target is remote. If the target directory is omitted, base name of the source directory is used. If both directories are omitted, current local and remote directories are used. If the target directory ends with a slash (except the root directory) then base name of the source directory is appended.
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 symbolic links are not created when uploading to remote server, because FTP protocol cannot do it. To upload files the links refer to, use ’mirror −RL’ command (treat symbolic links as files).
For options −−newer−than and −−older−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 comparison and uploads/downloads only newer files even if size is different. By default older files are transferred and replace newer ones.
−−upload−older allows replacing newer remote files with older ones (when the target side is remote). Some remote back-ends cannot preserve timestamps so the default is to keep newer files.
Recursion mode can be one of ’always’, ’never’, ’missing’, ’newer’. With the option ’newer’ mirror compares timestamps of directories and enters a directory only if it is older or missing on the target side. Be aware that when a file changes the directory timestamp may stay the same, so mirror won’t process that directory.
The options −−file and −−directory may be used multiple times and even mixed provided that base directories of the paths are the same.
You can mirror between two servers if you specify URLs instead of directories. FXP is automatically used for transfers between FTP servers, if possible.
Some FTP servers hide dot-files by default (e.g. .htaccess), and show them only when LIST command is used with −a option. In such case try to use ’set ftp:list-options −a’.
−−depth−first, −−no−empty−dirs and setting mirror:no−empty−dirs=true.
mkdir [−p] [−f] dir(s)
Make remote directories. If −p is used, make all components of paths. The −f option makes mkdir quiet and suppresses messages.
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.
Same as ’glob rm’. Removes specified file(s) with wildcard expansion.
mv file1 file2
Rename file1 to file2.
List remote file names
open [OPTS] site
Select a server by host name, URL or bookmark. When an URL or bookmark is given, automatically change the current working directory to the directory of the URL. Options:
pget [OPTS] rfile [-o lfile]
Gets the specified file using several connections. This can speed up transfer, but loads the net and server heavily impacting other users. Use only if you really have to transfer the file ASAP. Options:
put [−E] [−a] [−c] [−O base] lfile [−o rfile]
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.
Print current remote URL. Use ’−p’ option to show password in the URL.
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.
> get file &
 get file
> queue wait 1
> queue get another_file
> cd a_directory
> queue get yet_another_file
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’’.
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.
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 [OPTS] [[−d] delay] [command]
Repeat specified command with a delay between iterations. Default delay is one second, default command is empty.
repeat at tomorrow
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 suppress 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:
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 −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.
torrent [OPTS] torrent-files...
Start BitTorrent process for the given torrent-files, which can be a local file, URL, magnet link or plain info_hash written in hex or base32. Local wildcards are expanded. Existing files are first validated unless −−force−valid option is given. Missing pieces are downloaded. Files are stored in specified directory or current working directory by default. Seeding continues until ratio reaches torrent:stop-on-ratio setting or time of torrent:seed-max-time runs out.
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 future 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 to terminate.
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 (or ~/.config/lftp/rc if ~/.lftp does not exist). 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.
the following settable variables (you can also use
’set −a’ to see all variables and their
save plain text passwords in ~/.local/share/lftp/bookmarks or ~/.lftp/bookmarks on ’bookmark add’ command. Off by default.
When false, empty listings are not cached.
When false, cache is disabled.
cache:expire (time interval)
Positive cache entries expire in this time interval.
cache:expire-negative (time interval)
Negative cache entries expire in this time interval.
Maximum cache size. When exceeded, oldest cache entries will be removed from cache.
the commands in string are executed before lftp exits or moves to background.
the commands in string are executed before backgrounded lftp exits.
the commands in string are executed before foreground lftp exits.
the commands in string are executed before lftp moves to background.
the commands in string are executed before lftp terminates (either backgrounded or foreground).
the commands in string are executed once when all jobs are done.
the commands in string are executed once when all jobs in a queue are done.
default cls options for displaying completion choices. For example, to make completion listings show file sizes, set cmd:cls-completion-default to ’-s’.
default cls command options. They can be overridden by explicitly given options.
when true, cls would try to get exact file modification time even if it means more requests to the server.
enables csh-like history expansion.
The value is used when ’open’ is used with just host name without protocol. Default is ’ftp’.
if true, exit when a command fails and the following command is unconditional (i.e. does not begin with || or &&). lftp exits after the unconditional command is issued without executing it.
when true, lftp acts interactively, handles terminal signals and outputs some extra messages. Default is auto and depends on stdin being a terminal.
time of command execution, which is considered as ’long’ and a beep is done before next prompt. 0 means off.
default ls argument
when false, lftp refuses to go to background when exiting. To force it, use ’exit bg’.
when true (default), lftp detaches itself from the control terminal when moving to background, it is possible to attach back using ’attach’ command; when false, lftp tricks the shell to move lftp to background process group and continues to run, then fg shell command brings lftp back to foreground unless it has done all jobs and terminated.
The prompt. lftp recognizes the following backslash-escaped special characters that are decoded as follows:
insert @ if the current remote site user is not default
an ASCII bell character (07)
an ASCII escape character (033)
the remote hostname you are connected to
the name of the client (lftp)
current slot name
the username of the remote site 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 current working directory at the local site
the base name of the current working directory at the local site
the character corresponding to the octal number nnn
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
Number of jobs run in parallel in non-interactive mode. For example, this may be useful for scripts with multiple ’get’ commands. Note that setting this to a value greater than 1 changes conditional execution behaviour, basically makes it inconsistent.
Number of jobs run in parallel in a queue.
a boolean to control whether or not lftp uses remote completion. When true, Tab key guesses if the word being completed should be a remote file name. Meta-Tab does remote completion always. So you can force remote completion with Meta-Tab when cmd:remote-completion is false or when the guess is wrong.
when true, lftp saves last CWD of each site to ~/.local/share/lftp/cwd_history or ~/.lftp/cwd_history, allowing to do ’’cd -’’ after lftp restart. Default is true.
when true, lftp saves readline history to ~/.local/share/lftp/rl_history or ~/.lftp/rl_history on exit. Default is true.
when false, lftp does not show status line on terminal. Default is true.
when true, lftp updates terminal status if supported (e.g. xterm). The closure for this setting is the terminal type from TERM environment variable.
the time interval between status updates.
the number of lines to keep in readline history.
the format string to use to display terminal status. The closure for this setting is the terminal type from TERM environment variable. Default uses ’’tsl’’ and ’’fsl’’ termcap values.
The following escapes are supported:
This setting is the default value for cls −−time−style option.
when true, lftp prints the commands it executes (like sh −x).
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.
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. Examples:
cd directory &
When false, ’cd’ to a directory known from cache as existent will succeed immediately. Otherwise the verification will depend on cmd:verify-path setting.
when true, cls command and completion output colored file listings according to color:dir-colors setting. When set to auto, colors are used when output is a terminal.
file listing color description. By default the value of LS_COLORS environment variable is used. See dircolors(1).
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.
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’.
maximum number of DNS cache entries.
dns:fatal-timeout (time interval)
limit the time for DNS queries. If DNS server is unavailable too long, lftp will fail to resolve a given host name. Set to ’never’ to disable.
dns:order (list of protocol names)
sets the order of DNS queries. Default is ’’inet6 inet’’ which means first look up address in inet6 family, then inet and use them in that order. To disable inet6 (AAAA) lookup, set this variable to ’’inet’’.
if true, lftp will fork before resolving host address. Default is true.
If zero, there is no limit on the number of times lftp will try to lookup an address. If > 0, lftp will try only this number of times to look up an address of each address family in dns:order.
This setting can be used to substitute a host name alias with another name or IP address. The host name alias is used as the setting closure, the substituted name or IP address is in the value. Multiple names or IP addresses can be separated by comma.
local character set. It is set from current locale initially.
when true, lftp uses advisory locking on local files when opening them.
when true, lftp answers ’’yes’’ to all ssh questions, in particular to the question about a new host key. Otherwise it answers ’’no’’.
the character set used by fish server in requests, replies and file listings. Default is empty which means the same as local.
the program to use for connecting to remote server. It should support ’−l’ option for user name, ’−p’ for port number. Default is ’ssh −a −x’. You can set it to ’rsh’, for example.
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.
Send this string in ACCT command after login. The result is ignored. The closure for this setting has format user@host.
sets the password used for anonymous FTP access authentication. Default is "lftp@".
sets the user name used for anonymous FTP access authentication. Default is "anonymous".
if first server message matches this regex, turn on sync mode for that host.
when there is no support for SIZE command, try to catch file size from the "150 Opening data connection" reply.
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.
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.
files with matching name will be considered compressed and "MODE Z" will not be used for them.
bind data socket to the interface of control connection (in passive mode). Default is true, exception is the loopback interface.
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.
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.
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.
If true, lftp uses control connection address instead of the one returned in PASV reply for data connection. This can be useful for broken NATs. Default is false.
if set to false, empty lists from LIST command will be treated as incorrect, and another method (NLST) will be used.
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.
compression level (0-9) for uploading with MODE Z.
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.
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.
allowed port range for active mode. Format is min-max, or ’full’ or ’any’ to indicate any port. Default is ’full’.
use EPSV as preferred passive mode. Default is ’false’.
specifies FTP proxy to use. To disable proxy set this to empty string. Note that it is a 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:// then hftp protocol (FTP over HTTP proxy) is used instead of FTP automatically.
When set to ’’joined’’, lftp sends ’’user@proxy_user [AT] ftp.org’’ as user name to proxy, and ’’password@proxy_password’’ as password.
When set to ’’joined-acct’’, lftp sends ’’user [AT] ftp.org proxy_user’’ (with space) as user name to proxy. The site password is sent as usual and the proxy password is expected in the following ACCT command.
When set to ’’open’’, lftp first sends proxy user and proxy password and then ’’OPEN ftp.example.org’’ followed by ’’USER user’’. The site password is then sent as usual.
When set to ’’user’’ (default), lftp first sends proxy user and proxy password and then ’’user [AT] ftp.org’’ as user name. The site password is then sent as usual.
When set to ’’proxy-user@host’’, lftp first sends ’’USER proxy_user [AT] ftp.org’’, then proxy password. The site user and password are then sent as usual.
allow usage of REST command before LIST command. This might be useful for large directories, but some FTP servers silently ignore REST before LIST.
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.
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).
Additional regular expression for anonymous login, like ftp:retry-530.
Send this string in SITE GROUP command after login. The result is ignored. The closure for this setting has format user@host.
allow sending skey/opie reply if server appears to support it. On by default.
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.
if true, try to negotiate SSL connection with FTP server for non-anonymous access. Default is true. This and other SSL settings are only available if lftp was compiled with an ssl/tls library.
the argument for AUTH command, can be one of SSL, TLS, TLS-P, TLS-C. See RFC4217 for explanations. By default TLS or SSL will be used, depending on FEAT reply.
if true, lftp loads ssl:key-file for protected data connection too. When false, it does not, and the server can match data and control connections by session ID. Default is true.
if true, refuse to send password in clear when server does not support SSL. Default is false.
if true, request SSL connection for data transfers. This is cpu-intensive but provides privacy. Default is false.
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.
if true, request SSL connection for file list transfers. Default is true.
if true, lftp would issue CCC command after logon, thus disable ssl protection layer on control connection.
ftp:stat-interval (time interval)
interval between STAT commands. Default is 1 second.
when true, lftp strictly checks for multiline reply format (expects it to end with the same code as it started with). When false, this check is relaxed.
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.
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.
When true, assume that FEAT returned data are correct and don’t use common protocol extensions like SIZE, MDTM, REST if they are not listed. Default is false.
if false, lftp does not send ABOR command but closes data connection immediately.
when true (default), lftp sends ALLO command before uploading a file.
when true (default), lftp uses FEAT command to determine extended features of ftp server.
if true, lftp will try to set up direct connection between two ftp servers.
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.
when true, lftp uses IPTOS_LOWDELAY for control connection and IPTOS_THROUGHPUT for data connections.
the language selected with LANG command, if supported as indicated by FEAT response. Default is empty which means server default.
when true (default), lftp uses MDTM command to determine file modification time.
when true, lftp uses two argument MDTM command to set file modification time on uploaded files. Default is false.
when true, lftp will use MLSD command for directory listing if supported by the server.
when true, lftp will use "MODE Z" if supported by the server to perform compressed transfers.
when true, lftp sends ’SITE IDLE’ command with net:idle argument. Default is false.
when true, lftp sends 5-argument ’SITE UTIME’ command to set file modification time on uploaded files. Default is true.
when true, lftp sends 2-argument ’SITE UTIME’ command to set file modification time on uploaded files. Default is true. If 5-argument ’SITE UTIME’ is also enabled, 2-argument command is tried first.
when true (default), lftp uses SIZE command to determine file size.
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.
when true, lftp uses STAT instead of LIST command. By default ’.’ is used as STAT argument. Using STAT, lftp avoids creating data connection for directory listing. Some servers require special options for STAT, use ftp:list-options to specify them (e.g. −la).
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.
When set to auto, usage of TVFS feature depends on FEAT server reply. Otherwise this setting tells whether use it or not. In short, if a server supports TVFS feature then it uses unix-like paths.
if true, lftp sends ’OPTS UTF8 ON’ to the server to activate UTF-8 encoding (if supported). Disable it if the file names have a different encoding and the server has a trouble with it.
if true, lftp sends QUIT before disconnecting from ftp server. Default is true.
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 certain ftp servers with several network interfaces, when they do not set outgoing address on data socket, so it is disabled by default.
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.
disconnect after closing data connection. This can be useful for totally broken ftp servers. Default is false.
specifies initial PROT setting for FTPS connections. Should be one of: C, S, E, P, or empty. Default is empty which means unknown, so that lftp will use PROT command unconditionally. If PROT command turns out to be unsupported, then Clear mode would be assumed.
allow server/proxy side caching for ftp-over-http protocol.
specify corresponding HTTP request header.
when true, lftp automatically decodes the entity in hftp protocol when Content-Encoding header value matches deflate, gzip, compress, x-gzip or x-compress.
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.
if true, lftp will send ’<allprop/>’ request body in ’PROPFIND’ requests, otherwise it will send an empty request body.
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.
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.
if set to off, lftp will try to use ’PUT’ instead of ’MKCOL’ to create directories with hftp protocol. Default is off.
if set to off, lftp will not try to use ’PROPFIND’ to get directory contents with hftp protocol and use ’GET’ instead. Default is off.
when true, lftp will use Range header for transfer restart.
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.
specify corresponding HTTP request headers.
the authorization to use by default, when no user is specified. The format is ’’user:password’’. Default is empty which means no authorization.
allow server/proxy side caching.
specify corresponding HTTP request header.
send this cookie to server. A
closure is useful here:
set cookie/www.somehost.com "param=value"
when true, lftp automatically decodes the entity when Content-Encoding header value matches deflate, gzip, compress, x-gzip or x-compress.
specifies value of Content-Type HTTP request header for POST method. Default is ’’application/x-www-form-urlencoded’’.
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.
specifies value of Content-Type HTTP request header for PUT method.
specifies value for Referer HTTP request header. Single dot ’.’ expands to current directory URL. Default is ’.’. Set to empty string to disable Referer header.
if true, lftp modifies http:cookie variables when Set-Cookie header is received.
if true, lftp will send ’<allprop/>’ request body in ’PROPFIND’ requests, otherwise it will send an empty request body.
if set to off, lftp will try to use ’PUT’ instead of ’MKCOL’ to create directories with HTTP protocol. Default is on.
if set to off, lftp will not try to use ’PROPFIND’ to get directory contents with HTTP protocol and use ’GET’ instead. Default is on.
when true, lftp will use Range header for transfer restart.
the string lftp sends in User-Agent header of HTTP request.
specifies https proxy. Default value is taken from environment variable https_proxy.
when true, mirror will dereference symbolic links by default. You can override it by −−no−dereference option. Default if false.
specifies default exclusion pattern. You can override it by −−include option.
specifies default inclusion pattern. It is used just after mirror:exclude-regex is applied. It is never used if mirror:exclude-regex is empty.
when true, mirror doesn’t create empty directories (like −−no−empty−dirs option).
specifies order of file transfers. Valid values are: name, name-desc, size, size-desc, date, date-desc. When the value is name or name-desc, then mirror:order setting also affects the order or transfers.
mirror:order (list of patterns)
specifies order of file transfers when sorting by name. 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 the end of pattern list.
when true, mirror will overwrite plain files instead of removing and re-creating them.
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.
specifies number of parallel transfers mirror is allowed to start. Default is 1. You can override it with −−parallel option.
When true, mirror requires a source directory to be specified explicitly, otherwise it is supposed to be the current directory.
When set to off, mirror won’t try to copy file and directory permissions. You can override it by −−perms option. Default is on.
when true, mirror does not try to download files which are obviously inaccessible by the permission mask. Default is false.
specifies −n option for pget command used to transfer every single file under mirror. Default is 1 which disables pget.
colon separated list of directories to look for modules. Can be initialized by environment variable LFTP_MODULE_PATH. Default is ’PKGLIBDIR/VERSION:PKGLIBDIR’.
maximum number of concurrent connections to the same site. 0 means unlimited.
if true, foreground connections have priority over background ones and can interrupt background transfers to complete a foreground operation.
net:idle (time interval)
disconnect from server after this idle time. Default is 3 minutes.
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. Suffixes are supported, e.g. 100K means 102400.
limit accumulating of unused limit-rate. 0 means twice of limit-rate.
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.
limit accumulating of unused limit-total-rate. 0 means twice of limit-total-rate.
the maximum number of sequential tries of an operation without success. 0 means unlimited. 1 means no retries.
contains comma separated list of domains for which proxy should not be used. Default is taken from environment variable no_proxy.
ignore this number of hard errors. Useful to login to buggy FTP servers which reply 5xx when there is too many users.
sets the base minimal time between reconnects. Actual interval depends on net:reconnect-interval-multiplier and number of attempts to perform an operation.
sets maximum reconnect interval. When current interval after multiplication by net:reconnect-interval-multiplier reaches 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 reaches 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.
use given size for SO_SNDBUF and SO_RCVBUF socket options. 0 means system default.
use given size for TCP_MAXSEG socket option. Not all operating systems support this option, but Linux does.
net:timeout (time interval)
sets the network protocol timeout.
default number of chunks to split the file to in pget.
minimal chunk size to split the file to.
pget:save-status (time interval)
save pget transfer status this often. Set to ’never’ to disable saving of the status file. The status is saved to a file with suffix .lftp-pget-status.
when true, lftp answers ’’yes’’ to all ssh questions, in particular to the question about a new host key. Otherwise it answers ’’no’’.
the character set used by SFTP server in file names and file listings. Default is empty which means the same as local. This setting is only used for SFTP protocol version prior to 4. Version 4 and later always use UTF-8.
the program to use for connecting to remote server. It should support ’−l’ option for user name, ’−p’ for port number. Default is ’ssh −a −x’. You can set it to ’rsh’, for example.
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 16.
The protocol number to negotiate. Default is 4. The actual protocol version used depends on server.
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-server
Similarly you can run SFTP over SSH1.
Block size for reading. Default is 0x8000.
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 (OpenSSL only).
when true, lftp checks if the host name used to connect to the server corresponds to the host name in its certificate.
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 (OpenSSL only).
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.
when true, use Server Name Indication (SNI) TLS extension.
if set to yes, then verify server’s certificate to be signed by a known Certificate Authority and not be on Certificate Revocation List. You can specify either host name or certificate fingerprint in the closure.
free form priority string for GnuTLS. If built with OpenSSL the understood values are + or − followed by SSL3.0, TLS1.0, TLS1.1 or TLS1.2, separated by :. Example:
set ssl:priority "NORMAL:−SSL3.0:−TLS1.0:−TLS1.1:+TLS1.2"
torrent:ip (ipv4 address)
IP address to send to the tracker. Specify it if you are using an HTTP proxy.
torrent:ipv6 (ipv6 address)
IPv6 address to send to the tracker. By default, first found global unicast address is used.
maximum number of peers for a torrent. Least used peers are removed to maintain this limit.
port range to accept connections on. A single port is selected when a torrent starts.
explicit retracker URL, e.g. ’http://retracker.local/announce’.
when true, lftp saves metadata of each torrent it works with to ~/.local/share/lftp/torrent/md or ~/.lftp/torrent/md directory and loads it from there if necessary.
torrent:seed-max-time (time interval)
maximum seed time. After this period of time a complete torrent shuts down independently of ratio. It can be set to infinity if needed.
minimum number of peers when the torrent is complete. If there are less, new peers are actively searched for.
torrent:stop-min-ppr (real number)
minimum per-piece-ratio to stop seeding. Use it to avoid a situation when a popular piece causes quick raise of the total ratio.
torrent:stop-on-ratio (real number)
torrent stops when it’s complete and ratio reached this number.
torrent:timeout (time interval)
maximum time without any progress. When it’s reached, the torrent shuts down.
when true, DHT is used.
suggested filenames provided by the server are used if user explicitly sets this option to ’on’. As this could be security risk, default is off.
a time format string (see strftime(3)) for backup file name when replacing an existing file.
if this setting is off, get commands will not overwrite existing files and generate an error instead.
xfer:destination-directory (path or URL to directory)
This setting is used as default −O option for get and mget commands. Default is empty, which means current directory (no −O option).
when true, lftp aborts a transfer if it cannot write target file because of full disk or quota; when false, lftp waits for disk space to be freed.
the period over which weighted average rate is calculated to produce ETA.
show terse ETA (only high order parts). Default is true.
when true, the backup file created before replacing an existing file is not removed after successful transfer.
when true, lftp logs transfers to a file from xfer:log-file setting.
xfer:log-file (path to file)
the file to log transfers to. Default is ~/.local/share/lftp/transfer_log or ~/.lftp/transfer_log.
when true, lftp renames pre-existing file adding xfer:backup-suffix instead of overwriting it.
maximum size of the transfer log file. When the size is reached, the file is renamed and started anew.
maximum number of redirections. This can be useful for downloading over HTTP. 0 prohibits redirections.
the period over which weighted average rate is calculated to be shown.
temporary file name pattern, first asterisk is replaced by the original file name.
xfer:timeout (time interval)
maximum time without any transfer progress. It can be used to limit maximum time to retry a transfer from a server not supporting transfer restart.
when true, a file will be transferred to a temporary file in the same directory and then renamed.
when true, verify-command is launched after successful transfer to validate file integrity. Zero exit code of that command should indicate correctness of the file.
the command to validate file integrity. The only argument is the path to the file.
The name of a variable 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 (floating point) and x is time unit: d - days, h - hours, m - minutes, s - seconds. Default unit is second. E.g. 5h30m or 5.5h. Also the interval can be ’infinity’, ’inf’, ’never’, ’forever’ - it means infinite interval. E.g. ’sleep forever’ or ’set dns:cache-expire never’.
Boolean settings can be one of (true, on, yes, 1, +) for a True value or one of (false, off, no, 0, -) for a False value.
Tri-boolean settings have either a boolean value or ’auto’.
Integer settings can have a suffix: k - kibi, m - mebi, g - gigi, etc. They can also have a prefix: 0 - octal, 0x - hexadecimal.
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.
Execute given commands and don’t exit.
Use the given port to connect.
Use the given username and password to connect. Remember to quote the password properly in the shell. Also note that it is not secure to specify the password on command line, use ~/.netrc file or LFTP_PASSWORD environment variable together with −−env−password option. Alternatively you can use ssh-based protocols with authorized keys, so you don’t have to enter a password.
Don’t execute rc files from the home directory.
Execute commands from the file. May be specified multiple times.
Execute commands in the file and exit. This option must be used alone without other arguments (except −−norc).
Execute the given commands and exit. Commands can be separated with a semicolon, ’&&’ or ’||’. Remember to quote the commands argument properly in the shell. This option must be used alone without other arguments (except −−norc).
Other open options may also be given on the lftp command line.
The following environment variables are processed by lftp:
Used as local editor for the edit command.
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.
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.
Used to locate the directory that stores user-specific configuration files. If unset, ~/.lftp will be used. Please note that if this directory does not exist, then XDG directories will be used.
Used for −−env−password open option.
used to set initial color:dir-colors variable.
XDG_CONFIG_DIR, XDG_DATA_DIR, XDG_CACHE_DIR
Used to locate the directories for user-specific files when ~/.lftp (or $LFTP_HOME directory) does not exist. Defaults are ~/.config, ~/.local/share and ~/.cache respectively. The suffix /lftp is appended to make the full path to the directories.
system-wide startup file. Actual location depends on −−sysconfdir configure option. It is /etc when prefix is /usr, /usr/local/etc by default.
~/.config/lftp/rc or ~/.lftp/rc, ~/.lftprc
These files are executed on lftp startup after /etc/lftp.conf.
~/.local/share/lftp/log or ~/.lftp/log
The file things are logged to when lftp moves into the background in nohup mode.
~/.local/share/lftp/transfer_log or ~/.lftp/transfer_log
The file transfers are logged to when xfer:log setting is set to ’yes’. The location can be changed by xfer:log-file setting.
~/.local/share/lftp/bookmarks or ~/.lftp/bookmarks
The file is used to store lftp’s bookmarks. See the bookmark command.
~/.local/share/lftp/cwd_history or ~/.lftp/cwd_history
The file is used to store last working directories for each site visited.
~/.local/share/lftp/bg/ or ~/.lftp/bg/
The directory is used to store named sockets for backgrounded lftp processes.
~/.cache/lftp/DHT/ or ~/.lftp/DHT/"
The directory is used to store DHT id and nodes cache for IPv4 and IPv6. File name suffix is the host name.
~/.cache/lftp/edit/ or ~/.lftp/edit/"
The directory is used to store temporary files for edit command.
~/.local/share/lftp/torrent/md/ or ~/.lftp/torrent/md/"
The directory is used to store torrent metadata. It is especially useful for magnet links, cached metadata can be loaded from the directory. It can also serve as torrent history, file names are the info_hash of torrents.
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.
RFC854 (telnet), RFC959 (ftp), RFC1123, RFC1945 (http/1.0), RFC2052 (SRV RR), RFC2228 (ftp security extensions), RFC2389 (ftp FEAT), RFC2428 (ftp/ipv6), RFC2518 (WebDAV), RFC2616 (http/1.1), RFC2617 (http/1.1 authentication), RFC2640 (ftp i18n), RFC3659 (ftp extensions), RFC4217 (ftp over ssl), BEP0003 (BitTorrent Protocol), BEP0005 (DHT Protocol), BEP0006 (Fast Extension), BEP0007 (IPv6 Tracker Extension), BEP0009 (Extension for Peers to Send Metadata Files), BEP0010 (Extension Protocol), BEP0012 (Multitracker Metadata Extension), BEP0023 (Tracker Returns Compact Peer Lists), BEP0032 (DHT Extensions for IPv6).
https://tools.ietf.org/html/draft-preston-ftpext-deflate-04 (ftp deflate transmission mode),
http://www.rasterbar.com/products/libtorrent/dht_sec.html (DHT security extension)
http://xbtt.sourceforge.net/udp_tracker_protocol.html (UDP tracker)
lav [AT] yars.net
This manual page was originally written by Christoph Lameter <clameter [AT] debian.org>, for the Debian GNU/Linux system. The page was improved and updated later by Nicolas Lichtmaier <nick [AT] Feedback.ar>, James Troup <J.J.Troup [AT] comp.uk> and Alexander V. Lukyanov <lav [AT] yars.net>.