Thursday 28 November 2013

ELA_31_LFTP

LFTP :

Description
LFTP is a sophisticated file transfer program with command line interface. It supports FTP, HTTP, FISH, SFTP, HTTPS and FTPS protocols. GNU Readline library is used for input.

Every operation in lftp is reliable, that is any non-fatal error is handled and the operation is retried automatically. 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. This is useful for dynamic-ip machines which change their IP addresses quite often, and for sites with very bad internet connectivity.

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 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 (&&, ||).

Features:

 1. Interactive (Shell-like) & Non-interactive modes
 2. Scriptable
 3. Serrvers supported: FTP, FTPS, SSH(SFTP), HTTP, etc.
 4. Mirroring of content: forward (download) & reverse (upload)
 5. Regular expressions
 6. Job Engine

Tasks:
 1. Use 'lftp' to connect to VSFTPD
  a. 'lftp localhost' && 'open -u mallik'
Note: LFTP batches authentication commands and submits when control-channel commands such as 'ls' are received
---- Connecting to localhost (127.0.0.1) port 21 - (no connection)
<--- 220 Welcome to HINDUX FTP service. - (traffic from server to client)
---> FEAT - (traffic from client to server)

 2. Use 'lftp' to connect and mirror content
  a. 'mirror temp*' - forward mirror - downloads content from server to client
  b. 'mirror -Rv *' - reverse mirror - puts content on server from client

 3. Run external commands with '!command'
  a. '!bash' - launches an instance of BASH SHELL from within 'lftp'
  b. 'exit' - returns to 'lftp'

 4. Test rate-limiting with 'vsftpd'
  a. 'local_max_rate=1000' - B/s (Bytes per second)

 5. Job Management - Backgrounging
  a. Use: 'CTRL-Z' to background jobs
  b. Use: 'jobs' to view progress of jobs
  c. 'fg job_num' to foreground a specific job

 6. Explore LFTP environment
  a. '/etc/lftp.conf' - system-wide config file

 7. Connect using 'lftp' to: SSH & HTTP servers
  a. 'lftp http://192.168.0.100/rhel6'
  b. 'lftp -u mallik sftp://192.168.0.100'
 

No comments :

Post a Comment