美文网首页
Centos7 安装ftp服务

Centos7 安装ftp服务

作者: Kindey_S | 来源:发表于2023-11-23 18:27 被阅读0次

    环境

    硬件

    配置 测试配置
    CPU 1.8GHz
    内存 4GB
    核心 4核
    带宽 1000Mb

    软件

    • VMware® Workstation 16 Pro 16.1.1 build-17801498
    • CentOS Linux release 7.6.1810 (Core)
    • vsftpd 3.0.2

    安装过程

    查看是否已安装

    yum list installed vsftpd
    
    1700816768320.png

    通过yum命令安装

    yum install -y vsftpd
    

    查看版本,验证是否安装成功

    vsftpd -version
    

    创建ftp用户并设置密码

    useradd -d /joinway/ftp -s /bin/bash ftpuser
    passwd ftpuser
    

    确认权限

    ll /joinway
    
    1700817586242.png

    设置防火墙与selinux

    firewall-cmd --permanent --zone=public --add-service=ftp
    firewall-cmd --zone=public --add-port=21/tcp --permanent
    firewall-cmd --zone=public --add-port=20/tcp --permanent
    firewall-cmd --reload
    setsebool -P ftpd_full_access on
    firewall-cmd --list-ports
    firewall-cmd --list-services
    
    1700817628871.png 1700817661762.png

    调整vsftpd配置

    vim /etc/vsftpd/vsftpd.conf
    

    配置信息如下:

    # 修改
    anonymous_enable=NO
    
    # 解开
    ascii_upload_enable=YES
    ascii_download_enable=YES
    
    # 解开
    chroot_local_user=YES
    # 解开+修改
    chroot_list_enable=NO
    # 解开
    chroot_list_file=/etc/vsftpd/chroot_list
    
    # 新增
    allow_writeable_chroot=YES
    local_root=/joinway/ftp
    

    添加根目录用户

    vim /etc/vsftpd/chroot_list
    

    维护指令

    #启动服务
    systemctl start vsftpd.service
    #停止服务
    systemctl stop vsftpd.service
    #查看状态
    systemctl status vsftpd.service
    #开启自启动
    systemctl enable vsftpd.service
     #关闭自启动
    systemctl disable vsftpd.service
    

    相关文章

      网友评论

          本文标题:Centos7 安装ftp服务

          本文链接:https://www.haomeiwen.com/subject/wdsgwdtx.html