Vsftp服务的相关信息:

1.       安装包:

[root@localhost ~]# rpm -qa |grep vsftpd

vsftpd-2.0.5-12.el5

2.配置文件vsftpd.conf

配置参数

(a) 匿名用户

i. Anonymous_enable=YES 开启匿名

ii. Anon_umask=022匿名用户上传文件权限反码

iii. Anon_root=/var/ftp 设置默认访问FTP目录

iv. Anon_upload_enable=YES 文件上传

v. Anon_mkdir_write_enable=YES 写入权限

vi. Anon_other_write_enable=YES 删除改名等其他权限

vii. Anon_max_rate_0 最大传输速率(0为不限制,单位为字节)

(b) 本地用户

i. Local_enable=YES 开启本地用户

ii. Local_umask=022 本地上传文件权限反码

iii. Local_root=/var/ftp FTP根目录

iv. Chroot_local_user=YES 将本地用户禁锢在宿主目录中

v. Local_max_rate=0 限制本地用户传输速率

(c) 全局配置

i. Listen=YES 是否以独立运行的方式监听服务

ii. Listen_port=21 设置监听FTP的端口号

iii. Write_enable=YES 开启写入权限

iv. Download_enable=YES 下载权限

v. Dirmessage_enable=YES 切入目录后显示.message文件

vi. Xferlog_enable=YES 启用xferlog日志

vii. Xferlog_std_format=YES 启用标准xferlog日志格式

viii. Connect_from_port_20=YES 允许服务器主动模式

ix. Pasv_enable=YES 允许被动模式连接

x. Pasv_max_port=24600 设置被动模式最大端口号

xi. Pasv_min_port=24500 设置被动模式最小端口号

xii. Pam_service_name=vsftpd 设置用户认证的PAMwenjian位置(/etc/pam.d目录下)

xiii. Userlist_enable=YES 启用user_list用户列表

xiv. Userlist_deny=YES 禁止user list用户列表

xv. Max_clients=0 IP的并发数限制

xvi. Tcp_wrappers=YES 是否启用tcp_wrappers主机访问控制

 

案例:创建一个ftp服务器,使得匿名用户和本地用户都可以登陆并且可以创建文件或文件夹

   1.安装:

        [root@localhost ~]# yum install -y vsftpd

2.修改配置文件

[root@localhost ~]# vim /etc/vsftpd/vsftpd.conf

# Example config file /etc/vsftpd/vsftpd.conf 

# The default compiled in settings are fairly paranoid. This sample file

# loosens things up a bit, to make the ftp daemon more usable.

# Please see vsftpd.conf.5 for all compiled in defaults.

# READ THIS: This example file is NOT an exhaustive list of vsftpd options.

# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpds

# capabilities.

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).

anonymous_enable=YES

# Uncomment this to allow local users to log in.

local_enable=YES

# Uncomment this to enable any form of FTP write command.

write_enable=YES

# Default umask for local users is 077. You may wish to change this to 022,

# if your users expect that (022 is used by most other ftpd's)

local_umask=022

anon_umask=022

# Uncomment this to allow the anonymous FTP user to upload files. This only

# has an effect if the above global write enable is activated. Also, you will

# obviously need to create a directory writable by the FTP user.

#anon_upload_enable=YES

# Uncomment this if you want the anonymous FTP user to be able to create

# new directories.

anon_mkdir_write_enable=YES

2.      创建一个本地用户:

3.   将用户添加到vsftp用户表中:

      [root@localhost ~]# vim /etc/vsftpd/user_list

# vsftpd userlist

# If userlist_deny=NO, only allow users in this file

# If userlist_deny=YES (default), never allow users in this file, and

# do not even prompt for a password.

# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers

# for users that are denied.

root

bin

daemon

adm

lp

sync

shutdown

halt

mail

news

uucp

operator

games

nobody

wendy 

4.     测试:

       本地用户成功登陆!

  匿名用户可以登陆

匿名用户可以创建文件夹