vsftpd匿名上传文件

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]# 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云原生解决方案

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值