CentOS配置VSFTP服務


1.安裝vsftpd
  a、查看是否安裝vsftp
  [root@wsyjlly ~]# rpm -q vsftpd
  package vsftpd is not installed

  b、如果沒有則安裝vsftpd
  [root@wsyjlly ~]# yum  install -y  vsftpd
  Installed:
    vsftpd.x86_64 0:3.0.2-22.el7
  Complete!

  c、檢查安裝
  [root@wsyjlly ~]# whereis  vsftpd
  vsftpd: /usr/sbin/vsftpd /etc/vsftpd /usr/share/man/man8/vsftpd.8.gz


2.啟動服務
  [root@wsyjlly ~]# systemctl start vsftpd


3.查看服務狀態
  [root@wsyjlly ~]# systemctl status vsftpd
   vsftpd.service - Vsftpd ftp daemon
     Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
     Active: active (running) since Sun 2018-09-02 13:21:19 CST; 3s ago
    Process: 1847 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
   Main PID: 1848 (vsftpd)
     CGroup: /system.slice/vsftpd.service
               └─1848 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf


4.設置vsftpd開機自啟

  [root@wsyjlly ~]# systemctl enable vsftpd
  Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.


5.查看看機啟動服務中是否存在vsftpd服務
  [root@wsyjlly ~]# systemctl list-unit-files | grep vsftpd
  vsftpd.service                                   enabled
  vsftpd@.service                               disabled
  vsftpd.target                                     disabled


6.關閉匿名登錄,設置root用戶登錄

  • 修改 vsftpd.conf文件

    [root@wsyjlly ~]# vi /etc/vsftpd/vsftpd.conf
    設置anonymous_enable=NO

  • 修改ftpusers文件

    [root@wsyjlly ~]# vi /etc/vsftpd/ftpusers

    

 

  • 修改user_list文件

    [root@wsyjlly ~]# vi /etc/vsftpd/user_list

    


 

7.設置防火牆

  • 查看防火牆狀態

    [root@wsyjlly ~]# systemctl status firewalld
    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
       Active: inactive (dead)
         Docs: man:firewalld(1)
    [root@wsyjlly ~]#

  • 開啟防護牆

    [root@wsyjlly ~]# systemctl start firewalld

 

  • 防火牆開啟vsftpd服務

    [root@wsyjlly ~]# firewall-cmd --permanent --zone=public --add-service=ftp                                    

    success

    [root@wsyjlly ~]# firewall-cmd --reload
    success


8.設置SELinux

  • 查看SELinux狀態
    • [root@wsyjlly ~]# sestatus  SELinux status:
      SELinux status:                 enable        此時可掠過該步驟

    • [root@wsyjlly ~]# sestatus  SELinux status:

        SELinux status:                 disabled          此時需開啟SELinux

      •  編輯/etc/selinux/config文件,將SELinux的值設置為permissive后reboot

        [root@wsyjlly ~]# vi /etc/selinux/config

        

      • 執行下列命令:genhomedircontouch /.autorelabel后reboot

        [root@wsyjlly ~]# touch /.autorelabel

      • 標記完成后再將SELinux的值設置為enforcing后reboot

        [root@wsyjlly ~]# vi /etc/selinux/config

        
    

  • SELinux查看ftp狀態

    [root@wsyjlly ~]# getsebool -a | grep ftp

    

 

  • 設置ftpd_full_access為on

    [root@wsyjlly ~]# setsebool -P ftpd_full_access on


 

9. 重啟vsftpd服務器
    [root@wsyjlly ~]# systemctl restart  vsftpd
    [root@wsyjlly ~]# systemctl status  vsftpd

 

T


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM