What is FTP? And what is used for?
Category : Programming And Technical Issues
FTP is the abbreviation of File Transfer Protocol which is a protocol from application layer of the TCP/IP networking protocol. FTP works on top of TCP layer to provide a standard and uniform way of exchanging files remotely.
Because FTP works on top of TCP, it is connection oriented which means before file operation, a connection establishing is required and after completing the file operation a connection release is performed.
Differences from HTTP
Alike HTTP, FTP is composed from several text commands. HTTP instruction are done on a resource which can be static file, dynamic file or even virtual object. On the other side in the case of FTP, the commands are tightly related to a single file operation. For example there is instruction for file list, file upload, file download and so on. FTP is considered faster than HTTP in terms of file transfer because it is optimized for big files transfers and there is no much headers overhead comparing to HTTP.
Common FTP commands list
The following are list of the common FTP commands found in the standard FTP client.
|? or help||Displays the help screen|
|open example.com||opens an FTP connection to the host example.com. Presuming that there is FTP server listening to the standard FTP port number 22 at the host example.com|
|user||send new user information|
|cd example||change current directory to example|
|mkdir example||create a new directory named example|
|rmdir example||remove the directory named example, provided that it is empty (if it is not empty the command will fail)|
|pwd||display current working directory|
|dir||display the list of files and directories in the current directory|
|get myfile.html||download the file myfile.html|
|send myfile.html or put myfile.html||upload the file myfile.html from local machine to the remove host|
|rename myfile.html newname.html||rename the file myfile.html to newname.html|
|append local.txt remote.txt||append the contents of the local file local.txt to the remote file remote.txt|
|ascii||switch to ASCII transfer mode|
|binary||switch to binary transfer mode|
|delete myfile.html||delete the file myfile.html from remote host|
|quit or bye||exit FTP client|
Anonymous FTP is a feature or implementation of FTP server to allow any one to login into the FTP client with a public user name (any arbitrary email address) and with no password. Usually anonymous FTP is offered on public networks and universities to allow download of open source software using anonymous FTP.
ASCII mode vs BINARY mode
ASCII mode is a mode to allow transfer of readable roman letters text. With ASCII mode enabled the transfer of any binary or compressed files will just transfer a corrupted copy of the files. So the usage of this mode should be done with caution to make sure no binary files are transferred.
On the contrary a binary mode allows the transfer of binary files (i.e. executable files, images or zip files)
FTP PASV mode vs ACTIVE mode
Active modes is a transfer mode on which when a file transfer command requested by the client, the client should listen to a different non standard port and send the port number to the server in the request. Then the server will connect to this new port to start the data transfer. This method obviously will not work if the client machine is limited on ports or if there is a firewall on the client machine that prevent listening on non standard ports which is very common practice by security softwares. So as a resolution, PASSIVE mode was developed.
On PASSIVE mode the FTP server will start listening on a non standard port after it receives a file transfer request from the client (provided that PASV mode is enabled) then it will send the port number to the client in the response to the transfer request. After that the client should connect to this new port numeber and the transfer begines.
Popular FTP clients
- File Zilla: A windows based FTP client software that is open source.
- FireFTP: A Firefox addon that is open source and free ware.
Popular FTP Servers
FTP Servers With GUI / Windows based
- File Zilla: An open source FTP server software that works on windows.
- WS FTP: Stands for WinSock File Transfer Protocol. It is non free windows based software.
Command Line Based FTP Servers / Linux based
- vsftpd(Very Secure FTP Daemon): An open source software available on linux that support FTP and SFTP.
- Pure-FTPd: Another open source software available on linux and BSD.
What is SFTP?
SFTP is a secure protocol which works on top of SSH protocol. It provides a similar sets of FTP commands but commands and data are encrypted preventing intruders from stealing sensitive data or password information. A FTP software alone can not interpolate with SFTP, it must support SFTP protocol explicitly to be able to connect to SSH server.
- Web based file manager
Some web hosting providers do not provide FTP access especially free hosting in this case there will be usually web based file manager provided which provide access to basic file operations like file upload, download, files list, delete, edit and some file managers provide some more advanced operations like file move, copy, zip extraction and zip creation. One of the popular file manager software is the one provided as a part of cPanel.