Centos-6.9 ftp的配置过程

安装ftp服务器

[wuyujun@wuyujunlocalhost ~]$ rpm -qa|grep vsftpd            //查看是否安装ftp服务器
[wuyujun@wuyujunlocalhost ~]$ sudo yum install vsftpd -y      //安装ftp服务器
[wuyujun@wuyujunlocalhost ~]$ rpm -qa|grep vsftpd
vsftpd-2.2.2-24.el6.x86_64
[wuyujun@wuyujunlocalhost etc]$ sudo service vsftpd start         
为 vsftpd 启动 vsftpd:                                    [确定]
[wuyujun@wuyujunlocalhost ~]$ service vsftpd status            //查看Ftp服务器是否运行
vsftpd (pid 10383) 正在运行... 

 

配置ftp服务器
[wuyujun@wuyujunlocalhost ~]$ sudo 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 vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).

anonymous_enable=YES                                         #匿名是否启用,yes允许匿名登录/no不允许
#
# Uncomment this to allow local users to log in.

local_enable=YES                                            #是否允许本地用户登录,默认yes允许登录/no不允许
#
# 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
#
# 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                               #是否允许匿名用户建目录
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.

dirmessage_enable=YES             #是否显示目录说明文件, 默认是YES 但需要手工创建.message文件,这个.message,只有用命令登陆或者用工具,才可以看见,他不是一个弹出对话框,而是一段字符,如在pub下建立一个.message,那么在客户端进入pub目录时就会显示.message文档中的内容 

#
# The target log file can be vsftpd_log_file or xferlog_file.
# This depends on setting xferlog_std_format parameter

xferlog_enable=YES      #记录使用者所有上传下载信息
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).

connect_from_port_20=YES                                 #连接的端口
#
# If you want, you can arrange for uploaded anonymous files to be owned by   
# a different user. Note! Using "root" for uploaded files is not
# recommended!

#chown_uploads=YES                             #默认注释了,开启匿名用户上传用户映射,和下面一行一起使用
#chown_username=whoever                         #默认注释了,将匿名用户上传的文件的用户映射为whoever用户

#
# The name of log file when xferlog_enable=YES and xferlog_std_format=YES
# WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log

#xferlog_file=/var/log/xferlog                 #将上传下载信息记录到/var/log/vsftpd.log中
#
# Switches between logging into vsftpd_log_file and xferlog_file files.
# NO writes to vsftpd_log_file, YES to xferlog_file

xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.

#idle_session_timeout=600                                #可以设置空闲会话超时时间
#
# You may change the default value for timing out a data connection.

#data_connection_timeout=120                            #可以设置空闲的数据连接超时时间
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:

#ftpd_banner=Welcome to blah FTP service.       #将#去掉可设置登录FTP服务器时显示的欢迎信息,可以修改=后的欢迎信息内容。另外如在需要设置更改目录欢迎信息的目录下创建名为 .message 的文件,并写入欢迎信息保存后,在进入到此目录会显示自定义欢迎信息
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().

#chroot_local_user=YES    #设置所有的本地用户可以chroot(Change Root,也就是改变程序执行时所参考的根目录位置。CHROOT可以增进系统的安全性,限制使用者能做的事。)                       
#chroot_list_enable=YES     #设置文件/etc/vsftpd/chroot_list中的用户执行chroot
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list     #(只有/etc/vsftpd/chroot_list中的指定的用户才能执行 )  
       
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.

listen=YES                          #独立的vsftpd服务器
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

pam_service_name=vsftpd            #PAM所使用的名称.同userlist_*一样限制用户登陆,不同的是userlist_*在进行密码验证之前拒绝用户登陆,pam是在密码验证之后拒绝登陆.(提示密码错误) 用户列表默认存放在/etc/vsftpd/ftpusers 中,一行一个. (可通过/etc/pam.d/vsftpd重定向用户列表存放文件)
userlist_enable=YES               #为yes时, /etc/vsftpd/user__list文件中的用户将不能访问vsftpd服务器
tcp_wrappers=YES                 #支持tcp_wrappers,限制访问(/etc/hosts.allow,/etc/hosts.deny)/etc/hosts.allow 定义允许的地址;/etc/hosts.deny 定义拒绝的来源地址.

 


                                                              119,1        底端


[wuyujun@wuyujunlocalhost ~]$ sudo cat /etc/vsftpd/vsftpd.conf |grep -v '^#'  //查看主配置文件的默认配置
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES

pam_service_name=vsftpd                        
userlist_enable=YES                             
tcp_wrappers=YES                              

 

 

在文件资源管理器输入ftp://地址

 

 

 

也可以在浏览器中输入ftp://地址访问

 

 

 

PS:
local_enable=<YES/NO>             //是否本地用户访问
guest_enable=<YES/NO>             //是否允许来宾用户访问
anonymous_enable=<YES/NO>         //是否允许匿名用户访问

匿名用户配置
anon_world_readable_only=<YES/NO>   //允许匿名用户浏览,下载文件,默认没有这一项,只有在虚拟用户的配置文件里才有用
anon_other_write_enable=<YES/NO>     //默认没有这一项,允许匿名用户具有建立目录,上传之外的权限,如重命名,删除


userlist_enable=YES        //为yes时, /etc/vsftpd/user__list文件中的用户将不能访问vsftpd服务器
userlist_deny=YES        //默认没有这一项,与下面这条参数:userlist_file=/etc/vsftpd/localuser_list 结合使用
userlist_file=/etc/vsftpd/localuser_list  //默认没有这一项, 与上面参数:userlist_deny=YES结合使用此参数用,来改变存放可以登录或禁止登录的账号,userlist_deny为YES时,这里面的用户则不能登录,当为NO时,这里面的用户可以登录,和/etc/vsftpd/user_list是一个意思

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值