zoukankan      html  css  js  c++  java
  • CentOS 7 VSFTP 配置虚拟用户

    1. 安装VsFTP服务和组件

     yum install vsftpd db4 db4-utils
    
    

    2. 添加vsftp用户

    useradd vsftpd -d /home/vsftpd -s /sbin/nologin
    
    

    3. 编辑 文件 /etc/vsftpd.conf

    vi /etc/vsftp.conf
    
    

    设置以下配置项

    anonymous_enable=NO
    local_enable=YES
    write_enable=YES
    local_umask=022
    dirmessage_enable=YES
    xferlog_enable=YES
    connect_from_port_20=YES
    xferlog_std_format=YES
    chroot_local_user=YES
    pam_service_name=vsftpd
    userlist_enable=YES
    tcp_wrappers=YES
    
    guest_enable=YES
    guest_username=vsftpd
    user_config_dir=/etc/vsftpd/vuser_conf
    allow_writeable_chroot=YES
    
    

    4. 创建用户密码文本文件

    vim /etc/vsftpd/vuser_passwd.txt 
    

    (注意奇数行是用户名,偶数行是密码),添加以下内容:

    ftp1
    123456
    

    5. 生成虚拟用户认证的db文件

    执行以下命令:

    db_load -T -t hash -f /etc/vsftpd/vuser_passwd.txt /etc/vsftpd/vuser_passwd.db
    
    

    6. 编辑认证文件/etc/pam.d/vsftpd

    全部注释掉原来语句,再增加以下两句:

    auth required pam_userdb.so db=/etc/vsftpd/vuser_passwd
    account required pam_userdb.so db=/etc/vsftpd/vuser_passwd
    
    

    7. 创建虚拟用户配置文件

    mkdir /etc/vsftpd/vuser_conf/
    vi /etc/vsftpd/vuser_conf/ftp1
    
    

    注:文件名ftp1 等于vuser_passwd.txt里面的账户名,否则下面设置无效

    文件中添加以下内容:

    # 虚拟用户根目录,根据实际情况修改
    local_root=/home/vsftpd
    
    #可写
    write_enable=YES
    anon_umask=022
    anon_world_readable_only=NO
    anon_upload_enable=YES
    anon_mkdir_write_enable=YES
    anon_other_write_enable=YES
    
    

    8. 启动 VsFTP:

    systemctl start vsftpd
    
    

    9. 跟随系统启动而启动

    systemctl enable vsftpd
    
    

    10. 添加服务到防火墙的白名单中, 并重载

    firewall-cmd --add-service=ftp --permanent
    systemctl restart firewalld
    
    

    如果还需要继续添加新用户,请重复步骤4,5,7

  • 相关阅读:
    IDEA快捷键
    nginx之epoll模型的详细介绍
    Liunx权限修改命令
    小技巧3
    小技巧2
    小技巧1
    Ajax的简单使用
    dubbo
    快速创建虚拟机
    登录和注册功能的实现
  • 原文地址:https://www.cnblogs.com/orochihuang/p/14107088.html
Copyright © 2011-2022 走看看