Services and tunnels
lftp
An FTP client: logs in, lists, downloads and uploads, and with -d shows every command and reply.
lftp -u USER,PASSWORD HOST opens an FTP session; -e '…' runs lftp commands (ls, get, put, cat,
quit) and -d prints the control channel as it goes: ---> what lftp sends, <--- the server's replies, and
---- its own notes, such as which port it opens the data connection to. set ftp:passive-mode off switches to
active mode; set ftp:prefer-epsv off makes it ask with the classic PASV, whose reply shows the address.
lftp command usage
lftp -u USER,PASSWORD HOST lftp [-d] -u USER,PASSWORD -e 'COMMANDS; quit' HOST
Options
-
-u alice,s3cret - user and password
-
-d - debug: show every FTP command and reply
-
-e 'cat notes.txt; quit' - run these lftp commands, then stop
-
set ftp:passive-mode off - active mode: the server connects back
-
set ftp:prefer-epsv off - PASV rather than EPSV
lftp examples
-
lftp -u alice,s3cret fileServer.lab - Opens an interactive FTP session as alice.
-
lftp -d -u alice,s3cret -e 'set ftp:prefer-epsv off; cat notes.txt; quit' fileServer.lab - Prints notes.txt in passive mode, showing the PASV exchange and the data connection.
Pitfalls
- lftp tries
AUTH TLSfirst; a server without TLS answers530, and lftp goes on in the clear.set ftp:ssl-allow offskips the attempt.