Chinaunix首页 | 论坛 | 博客
  • 博客访问: 109350
  • 博文数量: 17
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 220
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-01 22:24
个人简介

打杂,吃饭,养娃

文章分类

全部博文(17)

文章存档

2011年(1)

2010年(4)

2009年(8)

2008年(4)

我的朋友

分类: LINUX

2009-05-27 23:28:12

前几天,一朋友让我帮忙搭个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,哈哈!
阅读(1644) | 评论(0) | 转发(0) |
0

上一篇:一点想法

下一篇:xen半虚拟化与全虚拟化

给主人留下些什么吧!~~