歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux服務器 >> vsftpd只能上傳浏覽,不能下載

vsftpd只能上傳浏覽,不能下載

日期:2017/3/2 16:39:00   编辑:Linux服務器

前幾天,一朋友讓我幫忙搭個ftp,需求是只能上傳,浏覽不能下載。初步一想,這權限按常規權限來做的話根本實現不了,因為浏覽跟下載是一個權限,沒辦法區分。朋友說了搞定就一頓飯,有點動力了,打算嘗試下,而且估計應該是可以實現的,因為linux有很多意想不到的事情。果然google了下就找到方法了,可以對用戶操作ftp的命令進行控制,那就簡單了。網上找到了能實現我需求的配置文件,一測試不行,想想還是自己寫吧。

  ok,test下果然成功了。

  附上相關說明:

  vsftpd.conf文件:

  connect_from_port_20=YES

  anonymous_enable=NO

  write_enable=YES

  local_umask=002

  listen_port=21

  listen=YES

  pasv_enable=YES

  use_localtime=YES

  connect_timeout=60

  accept_timeout=60

  data_connection_timeout=600

  local_enable=YES

  cmds_allowed=ABOR,CMD,LIST,MDTM,MKD,NLST,PASS,PASV,PORT,PWD,QUIT,SIZE,STOR,TYPE,USER

  chroot_list_enable=YES

  chroot_list_file=/etc/vsftpd/vsftpd.chroot.list

  pam_service_name=vsftpd

  xferlog_enable=YES

  xferlog_file=/var/log/vsftpd.log

  注意cmds_allowe這段

  以下是這段相關命令的說明:

  (要注意的是,這行裡面不能換行,不能有空格)

  # ABOR - abort a file transfer 取消文件傳輸

  # CWD - change working directory 更改目錄

  # DELE - delete a remote file 刪除文件

  # LIST - list remote files 列目錄

  # MDTM - return the modification time of a file 返回文件的更新時間

  # MKD - make a remote directory 新建文件夾

  # NLST - name list of remote directory

  # PASS - send password

  # PASV - enter passive mode

  # PORT - open a data port 打開一個傳輸端口

  # PWD - print working directory 顯示當前工作目錄

  # QUIT - terminate the connection 退出

  # RETR - retrieve a remote file 下載文件

  # RMD - remove a remote directory

  # RNFR - rename from

  # RNTO - rename to

  # SITE - site-specific commands

  # SIZE - return the size of a file 返回文件大小

  # STOR - store a file on the remote host 上傳文件

  # TYPE - set transfer type

  # USER - send username

  根據自己需要選擇吧,vsftpd的確很強大,ftp我只用vsftpd,哈哈

Copyright © Linux教程網 All Rights Reserved