How to Install, Configure and Secure FTP Server in CentOS 7 – [Comprehensive Guide]

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

34 Responses

  1. tilakraj says:

    It is possible to access this secure ftp via sftp client, because i can able to access this sftp server through ftp client, but sftp client it just went to halt,i could not able to access, also it does not gave any information about connection.

  2. becm says:

    Setsebool -P ftp_home_dir on Above centos7 Change to tftp_home_dir .

  3. chenhleang says:

    when i type ls command it show 425 failed to establish connection!!

  4. Aaron. Thank you for writing such a comprehensive article.

    Your article may have a problem in the following section:

    In Step 3: Security FTP Server with SELinux
    7. “…we will use semanage command…”

    I am running CentOS 7.4.1708 and when I tried to run this command:

    # semanage boolean -m ftpd_full_access --on

    I received the following error:

    -bash: semanage: command not found

    My fresh install of CentOS did not have the necessary package to run this command.

    I searched using Google and found out I did not have policycoreutils-python installed.

    After I ran:

    # yum install policycoreutils-python

    I was able to run “semanage”


    Paul Luciano, MCSE

  5. Brandon Winstead says:

    Aaron. Great article thank you. I have followed the instructions and seem to have some issues. I will say I’m a new to Linux. It appears that when you ftp in using filezilla the user has access to all directories.

    This is what my config file looks like. What am I doing wrong?


  6. gautam says:

    Can I setup ftp server on centos 6 by using these instructions? as this is for centos 7.

  7. devis says:

    Hello Aaron, I get confused, I can’t find this file on my system.


    would you like to help me. thanks dude

  8. QuocPham says:

    Hi Aaron,

    After following the instructions performance, error:

    530 Login or password incorrect!
    • Aaron Kili says:


      Make sure your username or password is correct when trying to login.

      • mike says:

        Hi Aaron,

        Thanks for this article,

        I have the same error as QuocPham, 530 login or password incorrect, I made sure that username and password were correct, but still i have the same error.

        please advise

        • Aaron Kili says:


          If you have FileZilla installed, it could be the one causing the problem: listening to all connections on port 21. Try to stop it, then try accessing the FTP server once more.

  9. Alistair says:

    After doing the SElinux part, I get this restarting vsftp

    Jul 23 22:52:04 centos systemd[1]: Unit vsftpd.service entered failed state.
    Jul 23 22:52:04 centos systemd[1]: vsftpd.service failed.
    Jul 23 22:52:04 centos polkitd[688]: Unregistered Authentication Agent for unix-process:12504:94070 (system bus name :1.69, object path /org/freedesktop/PolicyK

    • Aaron Kili says:


      Try to run the command:
      #systemctl status vsftpd
      to view the vsftpd service status, it can actually indicate what is wrong.
      Alternatively, look through the system journal for any issues related to vsftpd and give us feedback.
      #journalctl -u vsftpd

  10. hemant singh says:

    Hey Aaron, thanks a lot for helping out newbie like me. But i have tried that you mention above, i have got

    error:500 OOPS: cannot change directory:/home/hs
    Login failed.
    421 Service not available, remote server has closed connection

    every time i want to connect to ftp server and tried everything from selinux enforcing mode to disable,permissive nothing works.Hope you can help. Thanks

    • Aaron Kili says:


      Sorry for the late reply, i was trying to figure out possible cause of the problem. Ensure that you run the semanage command to set SELinux rule to allow FTP to read/write user’s home directory(remember this is after you restrict FTP users to their Home directories explained in step 6):
      # semanage boolean -m ftpd_full_access –on

      Then restart the ftpd service:
      #systemctl restart vsftpd

      Alternatively, try to perform the whole setup again, carefully following the steps in the guide. However, thanks for appreciating our work.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.