FTP stands for File Transfer Protocol is an Internet standard application-level TCP/IP protocol that can be used for transferring files between hosts on a TCP/IP internetwork.
How File Transfer Protocol Works
File Transfer Protocol (FTP) is one of the earliest Internet protocols and is still used for uploading and downloading files between clients and servers.
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).
FTP Client
An FTP client is an application that can issue FTP commands to an FTP server, while an FTP server is a service or daemon running on a server that responds to FTP commands from a client. FTP commands can be used to change directories, change transfer modes between binary and ASCII, upload files, and download files.
FTP uses Transmission Control Protocol (TCP) for reliable network communication by establishing a session before initiating data transfer. TCP port number 21 on the FTP server listens for connection attempts from an FTP client and is used as a control port for establishing a connection between the client and server, for allowing the client to send an FTP command to the server, and for returning the server’s response to the command.
Once a control connection has been established, the server opens port number 20 to form a new connection with the client for transferring the actual data during uploads and downloads.
What is Anonymous FTP?
A host that provides an FTP service may provide anonymous FTP access. Users typically log into the service with an ‘anonymous’ (lower-case and case-sensitive in some FTP servers) account when prompted for user name. Although users are commonly asked to send their email address instead of a password, no verification is actually performed on the supplied data. Many FTP hosts whose purpose is to provide software updates will allow anonymous logins.
List of FTP Commands (Windows command prompt)
FTP Command | Description of Command |
---|---|
! | This command toggles back and forth between the operating system and ftp. Once back in the operating system, typing exit takes you back to the FTP command line. |
? | Accesses the Help screen. |
append | Append text to a local file. |
ascii | Switch to ASCII transfer mode. |
bell | Turns bell mode on or off. |
binary | Switches to binary transfer mode. |
bye | Exits from FTP. |
cd | Changes directory. |
close | Exits from FTP. |
delete | Deletes a file. |
debug | Sets debugging on or off. |
dir | Lists files, if connected. dir -C = lists the files in wide format. dir -1 = Lists the files in bare format in alphabetic order. dir -r = Lists directory in reverse alphabetic order. dir -R = Lists all files in current directory and sub directories. dir -S = Lists files in bare format in alphabetic order. |
disconnect | Exits from FTP. |
get | Get file from the remote computer. |
glob | Sets globbing on or off. When turned off, the file name in the put and get commands is taken literally, and wildcards will not be looked at. |
hash | Sets hash mark printing on or off. When turned on, for each 1024 bytes of data received, a hash-mark (#) is displayed. |
help | Accesses the Help screen and displays information about the command if the command is typed after help. |
lcd | Displays local directory if typed alone or if path typed after lcd will change the local directory. |
literal | Sends a literal command to the connected computer with an expected one-line response. |
ls | Lists files of the remotely connected computer. |
mdelete | Multiple delete. |
mdir | Lists contents of multiple remote directories. |
mget | Get multiple files. |
mkdir | Make directory. |
mls | Lists contents of multiple remote directories. |
mput | Send multiple files. |
open | Opens address. |
prompt | Enables or disables the prompt. |
put | Send one file. |
pwd | Print working directory. |
quit | Exits from FTP. |
quote | Same as the literal command. |
recv | Receive file. |
remotehelp | Get help from remote server. |
rename | Renames a file. |
rmdir | Removes a directory on the remote computer. |
send | Send single file. |
status | Shows status of currently enabled and disabled options. |
trace | Toggles packet tracing. |
Type | Set file transfer type. |
user | Send new user information. |
verbose | Sets verbose on or off. |