Friday, March 4, 2011

VSFTPD CentOS

  1. Install vsftpd:
    # yum install vsftpd
  2. To start after reboot:
    # chkconfig vsftpd on
  3. Edit /etc/vsftpd/vsftpd.conf:
    anonymous_enable=NO
    chroot_local_user=YES
    userlist_deny=NO
    userlist_enable=YES
    userlist_file=/etc/vsftpd/vsftpd.user_list
  4. Edit or create /etc/vsftpd/vsftpd.user_list and add usernames with read write permissions
    user1
    user2
  5. Add ftp user:
     # /usr/sbin/useradd -g 50 -p password -s /bin/false -d /var/www/html/folder/ user1
  6. Set folder owner:
     # chown -R user1.apache /var/www/html/folder/
  7. Set shell:
     # chsh -s /sbin/nologin user1
  8. Configure SELinux:
     # /usr/sbin/setsebool -P ftp_home_dir 1
     # /usr/sbin/setsebool -P allow_ftpd_full_access 1
  9. Configure iptables to open port 21
This will prevent errors if permissions of folders sets correctly (530 login incorrect, 553 Could not create file, 500...)