天天看点

vsftpd用户配置 No.2              vsftpd cmds_allowed 权限控制

在配置ftp虚拟用户的过程中,还有一种配置方式。

yum -y install 安装vsftpd

cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak

编辑vsftpd.conf

开启下列选项:

anonymous_enable=NO

local_enable=YES

write_enable=YES

local_umask=022

anon_mkdir_write_enable=NO

dirmessage_enable=YES

xferlog_enable=YES

connect_from_port_20=YES

chown_uploads=NO

xferlog_file=/var/log/vsftpd.log

xferlog_std_format=YES

ascii_upload_enable=YES

ascii_download_enable=YES

ftpd_banner=Welcome to blah FTP service.

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd/chroot_list

listen=YES

pam_service_name=vsftpd

userlist_enable=YES

tcp_wrappers=YES

use_localtime=YES

pasv_enable=YES

user_config_dir=/etc/vsftpd/vsftpd_user_conf

具体配置的注释可以参考上篇文章的注释。

因为我们上边配置文件设置了用户锁定跟目录:因此我们在配置文件目录下创建的chroot_list 就是我们的ftp用户。

touch chroot_list

在/etc/vsftpd/下创建用户目录

创建ftp用户  useradd -m -d /home/test test -s /sbin/nologin   并设置密码!

mkdir  vsftpd_user_conf  

cd vsftpd_user_conf  touch 用户文件

cmds_allowed=FEAT,REST,CWD,LIST,MDTM,NLST,PASS,PASV,PORT,PWD,QUIT,RETR,SIZE,STOR,TYPE,USER,ACCT,APPE,CDUP,HELP,MODE,NOOP,REIN,STAT,STOU,STRU,SYST,MKD

最后我们在用户文件中配置ftp用户权限,重启vsftpd服务即可!

这里插入一个权限的说明文档,是我在网上找的!

cmds_allowed=ABOR,CWD,LIST,MDTM,MKD,NLST,PASS,PASV,PORT,PWD,QUIT,RETR,RMD,RNFR…………

注意:一定不能使用换行和空格,不然就没效果..

CWD - change working directory 更改目录

LIST - list remote files 列目录

MKD - make a remote directory 新建文件夹

NLST - name list of remote directory

PWD - print working directory 显示当前工作目录

RETR - retrieve a remote file 下载文件

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

DELE - delete a remote file 删除文件

RMD - remove a remote directory 删除目录

RNFR - rename from 重命名

RNTO - rename to 重命名

# 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

# less common commands:

# ACCT* - send account information

# APPE - append to a remote file

# CDUP - CWD to the parent of the current directory

# HELP - return help on using the server

# MODE - set transfer mode

# NOOP - do nothing

# REIN* - reinitialize the connection

# STAT - return server status

# STOU - store a file uniquely

# STRU - set file transfer structure

# SYST - return system type

本文转自岁月丶倾城博客51CTO博客,原文链接http://blog.51cto.com/alca0126/1775228如需转载请自行联系原作者

laihuadongcto

继续阅读