Friday, October 14, 2011

Setup FTP user in CentOS

Here are the steps in setting up your FTP user in CentOS 5.
*Make sure to login as root or as a sudoer

1. Check if vsftpd is already installed. In your terminal, type:
         rpm -q vsftpd

    If vsftpd is not installed, use the following command:
         yum install vsftpd

    To start vsftpd service, type the following command:
         /sbin/service vsftpd start
                          or
         /etc/init.d/vsftpd start

    To start httpd service on startup, type the following command:
         /sbin/chkconfig vsftpd on 


2. Edit vsftpd config.
        vim /etc/vsftpd/vsftpd.conf

    Add/Edit the following lines
    to set user list:
        userlist_deny=NO
        userlist_enable=YES
        userlist_file=/etc/vsftpd/vsftpd_users 

    to set log file location
         xferlog_enable=YES
         log_ftp_protocol=YES
         xferlog_std_format=NO

       * By default, vsftpd log file is set under /var/log/vsftpd.log
      
      You can also add the following line for vsftpd banner:
           banner_file=/etc/vsftpd/issue 

     To save your config, press ESC then type wq to save and quit from the vim editor. 


3. Create the files specified in the userlist_file and banner_file directives.
        vim /etc/vsftpd/vsftpd_users

    On the editor, type the ftp user name.
    ex:

         demo

         * You can add as many users as required.

        vim /etc/vsftpd/issue
    On the editor, type the message that serves as your ftp banner.
    ex
:
           NOTICE TO USERS
           Use of this system constitutes consent to security monitoring and testing.
           All activity is logged with your host name and IP address.


4. Restart vsftpd service
         /sbin/service vsftpd restart
                          or
         /etc/init.d/vsftpd restart

After your restart the vsftpd service, you can now establish an FTP user in your machine.