An FTP server lets you transfer files from one system to another, via a network. When two computers are connected to the Internet, you can use FTP to transfer files from one to the other even though the computers are not directly connected.
An FTP server attempts to authenticate users that request to use it. You can configure your FTP server to accept requests only from users who have an account on the system running the FTP server. Alternatively, you can configure the FTP server to accept requests from anyone, via a facility known as
anonymous FTP. It's fairly simple to install and configure an anonymous FTP server; however, hackers regularly exploit vulnerabilities in anonymous FTP servers, breaking into systems and causing manifold mischief. Because it's difficult to protect a system running anonymous FTP from attack, this section does not describe the process for installing and configuring anonymous FTP.
Selecting the Basic profile during Debian GNU/Linux installation causes installation of a standard FTP server.
To test your FTP server, start an FTP client by issuing the following command:
ftp localhost
The FTP server should prompt you for a login userid and password. If you correctly supply them, you should see the FTP prompt that lets you know the FTP server is ready to execute FTP subsystem commands. Type
quit
and press
Enter to exit the FTP client. Or, if you'd like to transfer some files, you can use the FTP subsystem commands described in
Table 12.1.
Table 12.1: Important FTP Subsystem Commands
Command |
Function |
!
command |
Invokes a shell on the local system. You can use this command, for example, to obtain a listing of the current directory on the local system by issuing the command
!ls , for a Unix system, or
!dir , for a Microsoft system. |
ascii |
Specifies that files will be transferred in ASCII mode. |
binary |
Specifies that files will be transferred in binary mode, which performs no translation. |
cd
directory |
Changes to the specified directory of the remote system. |
delete
file |
Deletes the specified file from the remote system. |
dir |
Displays the contents of the current directory of the remote system. |
get
file |
Retrieves the specified file from the remote system. |
help |
Displays command help information. |
lcd
directory |
Changes to the specified directory of the local system. |
mkdir
directory |
Creates the specified directory on the remote system. |
put
file |
Stores the specified local file on the remote system. |
pwd |
Displays the current working directory on the remote system. |
quit |
Exits the FTP subsystem. |
rmdir
directory |
Removes the specified directory from the remote system. |
If your FTP server fails to respond properly, check the line you added to the
inetd.conf file. If you're unable to find an error, reboot your system. If that fails to solve the problem, post a message to the
comp.os.linux.setup newsgroup.
Once your FTP server is working, try contacting it from a remote system. If you have a Microsoft Windows system, you can contact your server by using the built-in FTP client that works similarly to the Linux FTP client, interpreting the same FTP subsystem commands. Open an MS-DOS Prompt window and type the command:
ftp
server
where
server
specifies the hostname or IP address of your Linux server. Generally, once the FTP subsystem prompt is available, you should immediately issue the
binary
command. This command specifies that files will be transferred verbatim; without it, executable files, documents, and other files that contain binary data will be scrambled when transferred.
Most Windows users prefer to use a graphical FTP client. Many such clients, including WS-FTP, are freely available and make FTP access easy for even novice Windows users. FTP provides a very fast and reliable way for a Linux server to share files with Windows clients, without the need to install and configure Samba.