1.安装vsftpd
yum -y install vsftpd
#客户端
yum -y install ftp
2.编辑配置文件
[root@c7-43 other]# cat /etc/vsftpd/vsftpd.conf
anonymous_enable=YES
anon_upload_enable=YES
anon_other_write_enable=YES
anon_mkdir_write_enable=YES
#匿名用户不提示密码
no_anon_password=YES
#设置匿名用户为ftp,默认为anonymous
ftp_username=ftp
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=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
3.设置目录权限
匿名用户的默认上传路径为:/var/ftp/pub/
[root@c7-43 vsftpd]# cd /var/ftp/
[root@c7-43 ftp]# ll
total 0
drwxr-xr-x 2 root root 6 Apr 1 12:55 pub
在pub目录下新建一个目录other,用于上传文件
[root@c7-43 pub]# mkdir other
[root@c7-43 pub]# chmod -R 777 other/
[root@c7-43 pub]# ll
total 0
drwxrwxrwx 2 root root 6 May 17 22:47 other
4 开启服务
[root@c7-43 pub]# systemctl start vsftpd
5 验证匿名用户上传文件
[root@c7-43 pub]# ftp localhost
Trying ::1...
Connected to localhost (::1).
220 (vsFTPd 3.0.2)
Name (localhost:root): ftp
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
229 Entering Extended Passive Mode (|||46577|).
150 Here comes the directory listing.
drwxr-xr-x 3 0 0 19 May 17 14:47 pub
226 Directory send OK.
ftp> cd pub/other
250 Directory successfully changed.
ftp> put /tmp/123.txt aa.txt
local: /tmp/123.txt remote: aa.txt
229 Entering Extended Passive Mode (|||16054|).
150 Ok to send data.
226 Transfer complete.
ftp>
#验证已成功
[root@c7-43 other]# pwd
/var/ftp/pub/other
[root@c7-43 other]# ll
total 0
-rw------- 1 ftp ftp 0 May 17 22:50 aa.txt
[root@c7-43 other]#