FTP - 21

what is ftp?

The File Transfer Protocol (FTP) is a standard network protocol used for the transfer of computer files between a client and server on a computer network.

FTP is built on a client-server model architecture using separate control and data connections between the client and the server. FTP users may authenticate themselves with a clear-text sign-in protocol, normally in the form of a username and password, but can connect anonymously if the server is configured to allow it. For secure transmission that protects the username and password, and encrypts the content, FTP is often secured with SSL/TLS (FTPS) or replaced with SSH File Transfer Protocol (SFTP).

The default port of ftp is 21.

how to use ftp - command line tool

# syntax
ftp <DOMAIN>
ftp <IP>
ftp <USER@IP>
ftp <USER@DOMAIN>

##### establish an FTP connection
ftp domain.com
ftp user@ftpdomain.com

##### login (when an ftp server allows anonymous logins, you can login with the following credentials)
ftp:*
anonymous:*

##### list directory on remote server
ls # same options are available as on a local server

##### change to another directory
cd 

##### set your local directory in which you want to download ftp files
lcd /home/testUser/Desktop # download directory, if not set the directory you connected from will be the download directory

##### download files with ftp (get)
get file

# response :
# local: file remote: file 
# 200 PORT command successful. Consider using PASV.
# 150 Opening BINARY mode data connection for file (xxx bytes).
# 226 File send OK.
# XXX bytes received in x.xx secs (x.xxx MB/s).

##### download multiple files 
mget *.html # download all files in the current ftp directory with the extension : .html, anything before the extension does not matter

##### upload files with ftp (put)
put file # upload a file from your current directory
put /root/test/test.txt # uploads a file that was not in your local directory

##### upload multiple files with ftp 
mput *.html 

##### closing the ftp connection
bye
exit 
quit

##### additional help when you're in the ftp shell
help

Last updated