Build FTP server under Linux (reprint)

Source: Internet
Author: User

VSFTPD is the most respected FTP server program in the Linux distribution. Features are small and light, safe and easy to use. and is a completely free open source FTP software

Tools/Materials
    • CentOS6.4
Method/Step
  1. 1

    With online installation

    Yum Install vsftpd pam* db4*-y

    To configure VSFTP as a system service using the command

    Chkconfig--level vsftpd on

  2. 2

    Configuring the host for the VSFTPD service

    Useradd vsftpdadmin-s/sbin/nologin-m

    This vsftpdadmin is only used to replace root and does not require login

  3. 3

    Establish an FTP virtual hosting account

    Useradd vsftpuser-s/sbin/nologin-m

    This ftpuser only the host of a virtual account, which itself is not logged in

  4.  

    Configure the vsftpd.conf configuration before you back up the original

    vi/etc/vsftpd/ vsftpd.conf

    anonymous_enable=yes  -->  anonymous_enable=no   //Do not allow anonymous user access, which is allowed by default.

    chroot_list_enable=yes  -->  chroot_list_enable=yes        FTP users are not allowed to leave their home directory

    To increase the

    #设定虚拟用户个人Vsftp的配置文件存放路径. That is, the specified directory, will be stored in each vsftp virtual user personality profile, one need to note that these configuration file names must be the same as the virtual user name.

    user_config_dir=/etc/vsftpd/vconf/userlocal

    #这一步非常重要, remember this step. A new folder will be created according to this configuration

     

    #修改端口号

    ftp_data_port=4040  

    Reverse_lookup_enable= NO

     

    Pasv_enable=yes

    pasv_min_port=48790

    pasv_max_port=48800

    Listen _port=48796 #端口可以根据你自己实际情况配置, you can also use the default port. But for security reasons, configure

  5. Create a virtual user file

    Mkdir/etc/vsftpd/vconf

    Touch/etc/vsftpd/vonf/vir_user

  6. Create a virtual user

    Vi/etc/vsftpd/vonf/vir_user

    virtualuser //user name

    12345678 //password

  7. Build Database

    Db_load-t-T Hash-f/etc/vsftpd/vconf/vir_user/etc/vsftpd/vconf/vir_user.db

  8. Set Database file access permissions

    chmod 600/etc/vsftpd/vconf/vir_user

    chmod 600/etc/vsftpd/vconf/vir_user.db

  9. Modify/ETC/PAM.D/VSFTPD

    Auth sufficient pam_userdb.so Db=/etc/vsftpd/vconf/vir_user

    Account sufficient pam_userdb.so Db=/etc/vsftpd/vconf/vir_user

    (To use both the system user and the virtual user, you need to change the required to sufficient)

  10. According to the fourth step configuration user_config_dir=/etc/vsftpd/vconf/userlocal

    New Userlocal Folder

    Mkdir/etc/vsftpd/vconf/userlocal

  11. Create a file based on the user name established in step sixth

    For example, the sixth step establishes the account number is Virtualuser, then creates a new Virtualuser file

    Touch/etc/vsftpd/conf/userlocal/virtualuser

  12. Edit the file path that the user accesses

    Vi/etc/vsftpd/conf/userlocal/virtualuser

    Enter the following

    L ocal_root=//need to specify the site root directory, for example www.baidu.com is located in the folder/www/baidu

    Anonymous_enable=no #禁止匿名用户访问

    Write_enable=yes #开启写权限

    local_umask=022 #上传后文件的权限掩码

    Anon_upload_enable=no #关闭匿名下载

    Anon_mkdir_write_enable=no #关闭匿名创建文件夹

    Idle_session_timeout=60 #会话自动关闭时间 60 is for minutes

    data_connection_timeout=120 #数据延迟时间

    max_clients=10 #最大连接数

    Max_per_ip=5 #同一个ip同时允许5个IP联机

    local_max_rate=1048576 #实体用户传输速度限制, Unit b/S. 0 means no Limit

  13. Configure this to complete, restart the VSFTPD service: Service vsftpd restart.

    Check the system port status: NETSTAS-TULNP. If you can see that port 48796 is being vsftpd called, the start is successful.

Build FTP server under Linux (reprint)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.