Linux安装ftp过程

1.       安装vsftpd软件  

·        安装yum 安装 vsftpd  yum install -y vsftpd

·        安装完成后,启动 FTP 服务 systemctlstart vsftpd.service

·         监听端口是否成功netstat -nltp | grep 21

·        设置开机启动 chkconfig vsftpd on  

2.     防火墙设置

·        获取SELinuxgetsebool -a | grepftp

·        开启SELinux权限setsebool -P ftpd_full_access on

·        开放端口  firewall-cmd --permanent --zone=public --add-service=ftp

·        重启防火墙systemctlrestartfirewalld.service

3.     修改配置文件 /etc/vsftpd/vsftpd.conf

·        use_localtime=YES

·        listen_port=21

·        chroot_local_user=YES

·        idle_session_timeout=300

·        guest_enable=NO

·        guest_username=vsftpd

·        user_config_dir=/etc/vsftpd/vconf

·        data_connection_timeout=1

·        virtual_use_local_privs=YES

·        pasv_min_port=10060

·        pasv_max_port=10090

·        accept_timeout=5

·        connect_timeout=1

·        allow_writeable_chroot=YES

4.      建立虚拟用户

·        touch/etc/vsftpd/usertables

·        vim  /etc/vsftpd/usertables

    oxygen

    123456

·        生成虚拟用户数据

    db_load-T -t hash-f/etc/vsftpd/usertables/etc/vsftpd/usertables.db

·        设置权限

    chmod 600/etc/vsftpd/usertables.db

·         创建用户配置

        touchetc/vsftpd/vconf/oxygen

       #编辑oxygen写入

          local_root=/workspace/

            write_enable=YES

            anon_world_readable_only=NO

            anon_upload_enable=YES

            anon_mkdir_write_enable=YES

            anon_other_write_enable=YES

            allow_writeable_chroot=YES

·        添加组别

        groupaddvsftpd

         adduser -g vsftpd -s /sbin/nologin vsftpd

5.      编辑pam.d目录下文件 etc/pam.d/vsftpd

·        auth  sufficient/lib64/security/pam_userdb.sodb=/etc/vsftpd/usertable

·        accountsufficient/lib64/security/pam_userdb.so db=/etc/vsftpd/usertable

6.      重启服务

·        systemctl restartvsftpd.service # 重启服务

·         systemctlstart vsftpd.service  # 启动服务

·        systemctl statusvsftpd.service  # 服务状态查看

 

猜你喜欢

转载自blog.csdn.net/fzucts/article/details/80001360