FTP 服务安装

FTP service setup

  1. Setup vsftpd
    sudo apt-get install vsftpd -y

  2. Start vsftpd

    • check whether the port 21 is working
      sudo netstat -nltp | grep 21
    • if the above not start, you can do it manually
      sudo systemctl start vsftpd.service
  3. Config the User directory

    • make a directory sudo mkdir /home/uftp
    • make a welcome file sudo touch /home/uftp/welcome.txt
    • config user and create passwd
    • sudo useradd -d /home/uftp -s /bin/bash uftp
    • sudo passwd uftp
    • remove the file to avoid login failed. sudo rm /etc/pam.d/vsftpd
  4. Do some limitation

    • make the user only access the ftp instead of login the server sudo usermod -s /sbin/nologin uftp
    • config again sudo chmod a+w /etc/vsftpd.conf

      
      
      # 限制用户对主目录以外目录访问
      
      chroot_local_user=YES
      
      
      # 指定一个 userlist 存放允许访问 ftp 的用户列表
      
      userlist_deny=NO
      userlist_enable=YES
      
      
      # 记录允许访问 ftp 用户列表
      
      userlist_file=/etc/vsftpd.user_list
      
      
      # 不配置可能导致莫名的530问题
      
      seccomp_sandbox=NO
      
      
      # 允许文件上传
      
      write_enable=YES
      
      
      # 使用utf8编码
      
      utf8_filesystem=YES
      
      • create the access file for user list
        sudo touch /etc/vsftpd.user_list
        sudo chmod a+w /etc/vsftpd.user_list
        modify the user_list as followed:
        uftp
    • config the access authority

    • the main dir only read sudo chmod a-w /home/uftp
    • the pulic dir can be read and wrote sudo mkdir /home/uftp/public && sudo chmod 777 -R /home/uftp/public
    • restart the service sudo systemctl restart vsftpd.service
  5. Prepare the domain and just make the analyze ip then everything will be ok.

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值