Certification Objective 7.03: The Very Secure FTP Service
FTP, the File Transfer Protocol, is one of the original network applications developed with the TCP/IP protocol suite. It follows the standard model for network services, as FTP requires a client and a server. The FTP client is installed by default on most operating systems, including Red Hat Enterprise Linux. If you've installed the FTP Server package group, you've installed the default Red Hat FTP Server, the very secure FTP (vsFTP) daemon. But before we begin, let's look at FTP clients.
On The Job | Red Hat no longer includes alternate FTP servers such as WU-FTP. When you install vsFTP on your computer, you're installing the same FTP server used on FTP Client (lftp) The original FTP client software was a basic command line, text-oriented client application that offered a simple but efficient interface. Most Web browsers offer a graphical interface and can also be used as an FTP client.Any FTP client allows you to view the directory tree and files. Using ftp as a client is easy. You could use the ftp command to connect to a server such as Figure 7-7 illustrates a typical lftp session to ![]() Figure 7-7: A typical lftp session Another advantage of lftp is that it can handle all of the basic upload and download commands of a regular FTP client. Some of these commands are described in Table 7-1.
Almost all commands in FTP mode are run at the remote host, similar to a Telnet session. You can also run commands locally from the FTP prompt. When you start the command with an exclamation point (!), you can run regular shell commands.This is only a subset of the commands available through lftp. Typing the help command will give you a full list of the available commands. The command help cmd yields a brief description of the command itself. One graphical FTP client for Linux is GNOME FTP (GFTP). GNOME FTP provides an easy-to-use GUI interface to FTP. It also offers these features: Restartable transfers Multiple independent transfers Download file queuing Transferring whole directory trees (recursive transfers) Drag-and-drop transfer activation Session names and settings And with GFTP you don't even need to know a single FTP command. If you have installed the gftp RPM, you can start the GFTP client from a GUI command line with the gftp command. Alternatively, you can start it from the Red Hat GNOME or KDE desktop with the Main Menu | Internet | More Internet Applications | gFTP command.
|
Command | Description |
---|---|
anonymous_enable=YES | If you don't want anonymous access, you'll have to set this to NO. |
local_enable=YES | If you don't want regular users to log in, comment this out by adding a pound (#) character. |
write_enable=YES | If you don't want remote users writing to your directories, comment out this command. |
#chroot_list_enable=YES | If you set chroot_local_user=YES (see discussion that follows), you can configure users who are allowed to roam through your directories by activating this command. |
pam_service_name=vsftpd | Configures Pluggable Authentication Module (PAM) security. For more information, see Chapter 10. |
userlist_enable=YES | Don't change this! This keeps users such as root from logging into your system. |
tcp_wrappers=yes | Supports the use of security commands in /etc/hosts.allow and /etc/hosts.deny. See Chapter 10. |
By default, vsFTP is configured to disable logins from sensitive users such as root, bin, and mail. The userlist_enable=YES command points to a list of disabled users in /etc/vsftpd.user_list. As vsFTP also uses Pluggable Authentication Modules (PAM) for security, it also disables the users in /etc/vsftpd.ftpusers. The list of users in the default versions of this file are identical.If you want regular users to log into your FTP server, you should add the chroot_local_user=YES command. This helps secure your system by keeping regular users from navigating to your top-level root directory (/).A couple of useful features for users help welcome them to your server. The following command provides a message for users who are logging into your system:
ftpd_banner=Welcome to blah FTP service
This next message looks for a .message file in each directory and sends it to the client:
dirmessage_enable=YES
Unfortunately, these messages don't work for users who log into your system using a client such as lftp.Access by root and many service users are disabled by default. If you try to log in as root using lftp, it will look like you're connected. But when you try to do something as root, you'll see messages delaying your commands 'before reconnect.'Exercise 7-5: Configuring a Basic FTP Server
In this exercise, you'll install and activate a basic vsFTP server on your RHEL 3 computer. While you should ideally also have a second computer, it isn't absolutely necessary here.
Check your system to see if the vsFTP server is installed. The easiest way is with the following command:
# rpm -q vsftpd
If it isn't already installed, use the techniques discussed in earlier chapters to install the vsFTP RPM package on your computer.
Activate the vsFTP server with the service vsftpd start command.
Make sure this server is automatically activated the next time you boot Linux with the following command:
# chkconfig --level 35 vsftpd on
Log into the vsFTP server as a regular user. You should preferably log in from a remote computer.
Once you're logged in, run the cd .. command twice (remember the space between the command and the two dots). Explore the local directory. You should see a danger here, as this is the root directory for the FTP server computer.
Close the FTP client session.
If you're concerned about the security issues, deactivate the vsFTP server. The best way to secure FTP is to uninstall the vsFTP server. However, if you need a vsFTP server, work with the lab at the end of the chapter.