Tech Nuske

Tech Nuske

Friday, 13 April 2012

Install FTP on your Linux


The File Transfer Protocol (FTP) is used as one of the most common means of copying files between servers over the Internet. Most web based download sites use the built in FTP capabilities. In this blog i will show you how to convert your linux system into an FTP server using the default Very Secure FTP Daemon (VSFTPD) package.

FTP Overview

FTP relies on a pair of TCP ports to get the job done. It operates in two connection channels as I'll explain:
  1. FTP Control Channel, TCP Port 21: All commands you send and the ftp server's responses to those commands will go over the control connection, but any data sent back (such as "ls" directory lists or actual file data in either direction) will go over the data connection. 
  2. FTP Data Channel, TCP Port 20: This port is used for all subsequent data transfers between the client and server.

Types of FTP

The two main types of FTP are active and passive. In active FTP, the FTP server initiates a data transfer connection back to the client. For passive FTP, the connection is initiated from the FTP client. These are illustrated in figure:

Installing FTP on Linux (in Ubuntu)

Use this command as a superuser (root): (using su) 

Install vsftpd  package
                # apt-get install vsftpd

Start vsfpd service
               # service vsftpd start

Stop/restart vsdfpd service
              # service vsftpd stop
              # service vsftpd restart

Test ftp server
             # ftp localhost

You can check yout vsftpd service is running or not using:
             # service vsftpd status

Now, Really Interesting thing in which you are more interested. In many case you will find some problem regarding FTP. (Ex.you may not able to put some file.) You need to configure your vsftpd service.

Configuring VSFTPD (Config file: /etc/vsftpd.conf)

  1. VSFTPD allows only anonymous FTP downloads to remote users, not uploads from them. This can be changed by modifying the anon_upload_enable directive.
  2. VSFTPD doesn't allow anonymous users to create directories on your FTP server. You can change this by modifying the anon_mkdir_write_enable directive.
  3. VSFTPD logs FTP access to the /var/log/vsftpd.log log file. You can change this by modifying the xferlog_file directive.  
  4. Allow local user to log in (local_enable)
  5. Allow anonymous to log in (anonymous_enable)
  6. Enable FTP write command (write_enable)
By uncomment or setting new value, you can achieve your desire goal.
And don't forget to restart vsftpd service.

Thanks in advance for reading, Keep signed in I will show you FTP Problems and solutions with Firewalls, FTP Security issues next week.

Enjoy and keep smiling,
Brijesh : Smile is a language that everybody understands. (",)..!!!

2 comments: