FTP Server Configuration ( File Transfer Protocol )
Introduction Learning Objective: By the end of the chapter, you will be able to: Describe what is FTP Server Describe types of FTP Server Describe Configuration of FTP Server Describe Configuration of FTP Greeting Banner Describe Advantages and Disadvantages of FTP Server
Introduction to FTP FTP (File Transfer Protocol) is a network protocol. It is used for data transfer from one computer to another through a network called internet. File transfer protocol is used for exchanging and manipulating files over a TCP Network. An FTP client can connect to an FTP server to manipulate the files on the server. FTP works on a pair of TCP ports to get the job done. It operates in two connection channels.
Active FTP : Types of FTP FTP control connection to port 21 from high port High port Client computer FTP data connection initiation From port 20 on server to high port on client Server Port 20 Passive FTP : FTP control connection to port 21 from high port High port Client computer FTP data connection initiation From high port on client to high port on the server Server High port
( i ) Configuration Procedure Required packages vsftpd (very secure file transfer protocol Daemon Port number 20 ( To transfer the data) 21 (To make control connection ) To check whether the packages are installed or not # apt-get install vsftpd Main configuration file # vi /etc/vsftpd/vsftpd.conf To start the service # /etc/init.d/vsftpd restart
( ii ) - Testing the FTP server After finishing the set-up of FTP server we need to start the service. After starting the service we will adopt the role of the client to test the server.
(iii ) - Configuring an anonymous FTP for file download Anonymous users cannot read form any directory from the machine in which the server is hosted. By default, the vsftpd packages creates a directory tree starting at /home/ftp/ and enables 'anonymous read access' to this directory. Anonymous users connect to the /var/ftp directory when they establish a session with the FTP server.
Using FTP client to test anonymous read access 1) Now you can test for anonymous access by using an FTP client to try grab a copy of this file via FTP connection. 2) Both Windows and Linux machines can use FTP using the command line. 3) FTP clients are given as a default package on the installation of the system. 4) Connect to the FTP server and log in as the anonymous user.
Continuation : 5) You can list the files in the current directory. This is the directory where you connected. 6) Any Linux command related to file system navigation will be executed in the server. To execute a command in the local system, precede the command with an exclamation mark (!). To change the local directory, use the 'lcd command.
Continuation : 7) To download a file, use the 'get' command. To get multiple files, use the 'mget command. 8) To exit out of the session, use the bye command.
( iv ) - Configuring an anonymous FTP server for file upload Anonymous FTP users can write only into directories that we allow them to write to. By default, vsftpd does not allow users to upload to the FTP server at all; We must first configure the server to allow anonymous users to write to some directory.
Continuation : To configure the vsftpdserver to allow anonymous upload, edit the configuration file # vi /etc/vsftpd/vsftpd.conf Restart the FTP service for the changes to take effect by using the command # /etc/init.d/vsftpd restart
Using an FTP client to test anonymous write access Connect to the server and authenticate as anonymous user
Continuation : Change to the directory in which you have write permissions. Upload the file you want using the 'put' command. For multiple files use the 'mput' command.
( v ) FTP authentication Each system will be having an user account called boss This account can be used to gain access to the FTP server. These users will be presented their HOME directories to work with.
Disabling Local System Users Account for FTP By default, the users logged in through FTP would have the same permissions to read, write and execute the contents of their home directories via FTP. Authentication via FTP is not encrypted, so allowing FTP via user accounts is actually not a good idea to allow access to your system. Edit the vsftpd configuration file to disallow access to the system users and comment the following line.
Blocking FTP Access for selected user accounts To deny FTP access to individual users, edit the vsftpd configuration file to allow system users access to the FTP server. Edit the /etc/vsftpd.ftpusers file. This file contains the list of system users not allowed to access to the FTP server. Add the name of the users that you want to deny access to.
( vi ) - Configuration of FTP greeting banner Open the vsftpd configuration file for editing. Search for the line that asks you to customize a login banner. Uncomment the line that says 'ftpd_banner' and write an appropriate login banner. Restart the FTP server and see if your banner has taken effect.
Advantages of FTP service We can access data remotely. We can directly upload and download files from pc. User can connect to FTP server anonymously. Easy to manage multiple files.
Disadvantages of FTP service If more number of clients requests the service simultaneously, the server be overloaded.
Conclusion In this chapter we have learnt: What is FTP Server Types of FTP Server Configuration of FTP Server Configuration of FTP Greeting Banner Advantages and Disadvantages of FTP Server