zoukankan      html  css  js  c++  java
  • CentOS 7: Install vsftpd

    Install vsftpd

    All commands should be run with ‘root’ user. Run the following command in terminal to install vsftpd package:

    yum install vsftpd ftp -y

    Configure vsftpd

    Edit vsftpd configuration file /etc/vsftpd/vsftpd.conf,

    vi /etc/vsftpd/vsftpd.conf

    Find the following lines and make the changes as shown below:

     [...]
    ## Disable anonymous login ##
    anonymous_enable=NO
    
    ## Uncomment ##
    ascii_upload_enable=YES
    ascii_download_enable=YES
    
    ## Uncomment - Enter your Welcome message - This is optional ##
    ftpd_banner=Welcome to UNIXMEN FTP service.
    
    ## Add at the end of this  file ##
    use_localtime=YES

    Enable and start the vsftpd service:

    systemctl enable vsftpd
    systemctl start vsftpd

    Firewall And SELinux Configuration

    Allow the ftp service and port 21 via firewall.

    firewall-cmd --permanent --add-port=21/tcp
    firewall-cmd --permanent --add-service=ftp

    Restart firewall:

    firewall-cmd --reload

    Then, update the SELinux boolean values for FTP service:

    setsebool -P ftp_home_dir on

    Create FTP users

    By default, root user is not allowed to login to ftp server for security purpose. So, let us create a normal testing user called “sk” with password “centos”.

    useradd sk
    passwd sk
    

    Connecting to FTP server

    Now, try to connect to FTP server itself with user “sk”:

    ftp 192.168.1.101

    Enter the ftp user name and password.

    Sample Output:

    Connected to 192.168.1.101 (192.168.1.101).
    220 Welcome to UNIXMEN FTP service.
    Name (192.168.1.101:root): sk
    331 Please specify the password.
    Password:
    230 Login successful.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp>

    最后,如果出现500 OOPS: chroot的错误,说明系统中没有ftp_home_dir目录,那么需要用以下命令代替:
    setsebool -P ftpd_full_access 1

    如果出现ftp能连接,但是ls出现connect refuse的错误,需要将selinux关闭。修改方法为打开/etc/selinux/config文件,将SELINUX改为disabled即可。

  • 相关阅读:
    nginx centos 服务开机启动设置实例详解
    CentOS打开关闭永久防火墙指定端口
    使用 nginx 反向代理 sqlserver 访问 配置
    Springboot集成Mybatis
    linux中查看java进程
    mybatis关于jdbc连接报错,5.5.62MySQL连接,出现com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure等问题解决方法
    索引的分析
    MySQL慢查询分析工具
    MySQL锁
    nGrinder介绍、编写脚本与执行(完整版)
  • 原文地址:https://www.cnblogs.com/ilovewindy/p/4544359.html
Copyright © 2011-2022 走看看