1.安装vsftpd
yum -y install vsftpd
2. 配置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=NO # # 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 # # 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 # "/etc/vsftpd/vsftpd.conf" 122L, 4662C
3. 增加FTP帐户
useradd test -s /sbin/nologin passwd test
4. 编辑user_list文件,允许test用户访问FTP (注意这里要和vsfptd.conf配合配置,看下边截图提示,跟conf中userlist_deny参数配置属性有关)
vi /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 taotao ~
5. 建立我们的根目录,并设置访问权限
我的系统配置根目录为 /data/files/images(和Nginx一块做http图片服务器使用)
下边命令修改该文件夹的owner和用户访问权限
chown -R test /data/files/images chmod -R 755 /data/files/images
6. 开启vsftpd服务
service vsftpd start
7.默认开启vsftp服务
chkconfig vsftpd on
centos卸载vsftpd
停止vsftpd服务,然后查找当前系统安装的vsftpd版本
用rpm -e 查找结果进行删除
rpm -e vsftpd-2.2.2-21.el6.i686