vsftpd匿名用户上传的文件无法下载

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
gfedcba
帖子: 17
注册时间: 2011-05-12 0:44

vsftpd匿名用户上传的文件无法下载

#1

帖子 gfedcba » 2011-05-12 0:48

匿名用户上传后权限是这样:
-rwx------ 1 ftp ftp 67072 2011-05-11 23:23 TEST.DLL

按理说匿名用户就是ftp用户,拥有了rwx的权限,可是为什么就无法下载TEST.DLL,会出现错误:550 Failed to change directory


这是我的conf

代码: 全选

# Example config file /etc/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
#
# 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
anon_other_write_enable=YES
download_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
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
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#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.
#
# 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_list_enable=YES
# (default follows)
#chroot_list_file=/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
#
# 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
scutdk
帖子: 299
注册时间: 2009-07-25 19:23

Re: vsftpd匿名用户上传的文件无法下载

#2

帖子 scutdk » 2011-05-12 1:00

楼主看看是目录权限问题么?
550 Failed to change directory

Ubuntu 桌面培训- 全中文官方文档,含汉化截图,提供PDF
gfedcba
帖子: 17
注册时间: 2011-05-12 0:44

Re: vsftpd匿名用户上传的文件无法下载

#3

帖子 gfedcba » 2011-05-12 9:51

不是目录权限问题,这个文件是放在PUB文件夹里面的,PUB文件夹我给了777的权限
我把TEST.DLL的权限改成
-rwx---r-- 1 ftp ftp 67072 2011-05-11 23:23 TEST.DLL

就可以下载

啊,难道匿名登录用的用户不是ftp,而是other??????????????????
头像
bigsun
帖子: 301
注册时间: 2009-01-11 16:05

Re: vsftpd匿名用户上传的文件无法下载

#4

帖子 bigsun » 2011-05-12 11:48

代码: 全选

#local_umask=022
将前面的#去掉试试.
再试试

代码: 全选

anon_umask==022
上次由 bigsun 在 2011-05-12 11:55,总共编辑 1 次。
gfedcba
帖子: 17
注册时间: 2011-05-12 0:44

Re: vsftpd匿名用户上传的文件无法下载

#5

帖子 gfedcba » 2011-05-12 11:50

将#去掉上传的文件权限就是755,可以下载

但是我不明白的是这样的权限 -rwx------ 1 ftp ftp 67072 2011-05-11 23:23 TEST.DLL
为什么就不能下载,匿名用户用的是ftp的帐号,按理说有r的权限,是可以下载的?
scutdk
帖子: 299
注册时间: 2009-07-25 19:23

Re: vsftpd匿名用户上传的文件无法下载

#6

帖子 scutdk » 2011-05-12 13:34

gfedcba 写了:将#去掉上传的文件权限就是755,可以下载

但是我不明白的是这样的权限 -rwx------ 1 ftp ftp 67072 2011-05-11 23:23 TEST.DLL
为什么就不能下载,匿名用户用的是ftp的帐号,按理说有r的权限,是可以下载的?
匿名用户有两个帐号吧?一个是ftp,一个是anonymous。楼主匿名登录的时候用的是哪个帐号呢?如果是ftp的话应该没问题,但是后边那个就有问题了吧?

Ubuntu 桌面培训- 全中文官方文档,含汉化截图,提供PDF
gfedcba
帖子: 17
注册时间: 2011-05-12 0:44

Re: vsftpd匿名用户上传的文件无法下载

#7

帖子 gfedcba » 2011-05-12 14:54

scutdk 写了:
gfedcba 写了:将#去掉上传的文件权限就是755,可以下载

但是我不明白的是这样的权限 -rwx------ 1 ftp ftp 67072 2011-05-11 23:23 TEST.DLL
为什么就不能下载,匿名用户用的是ftp的帐号,按理说有r的权限,是可以下载的?
匿名用户有两个帐号吧?一个是ftp,一个是anonymous。楼主匿名登录的时候用的是哪个帐号呢?如果是ftp的话应该没问题,但是后边那个就有问题了吧?

我是这样子访问的 ftp://localhost,也不用登录。可是vsftpd官方文档说的是匿名访问用的是ftp帐号
scutdk
帖子: 299
注册时间: 2009-07-25 19:23

Re: vsftpd匿名用户上传的文件无法下载

#8

帖子 scutdk » 2011-05-12 18:13

gfedcba 写了:
scutdk 写了:
gfedcba 写了:将#去掉上传的文件权限就是755,可以下载

但是我不明白的是这样的权限 -rwx------ 1 ftp ftp 67072 2011-05-11 23:23 TEST.DLL
为什么就不能下载,匿名用户用的是ftp的帐号,按理说有r的权限,是可以下载的?
匿名用户有两个帐号吧?一个是ftp,一个是anonymous。楼主匿名登录的时候用的是哪个帐号呢?如果是ftp的话应该没问题,但是后边那个就有问题了吧?

我是这样子访问的 ftp://localhost,也不用登录。可是vsftpd官方文档说的是匿名访问用的是ftp帐号

你试试用原始的ftp命令登陆试试看

Ubuntu 桌面培训- 全中文官方文档,含汉化截图,提供PDF
gfedcba
帖子: 17
注册时间: 2011-05-12 0:44

Re: vsftpd匿名用户上传的文件无法下载

#9

帖子 gfedcba » 2011-05-12 18:56

文件的权限是这样的

代码: 全选

-rwx------ 1 ftp ftp 67072 2011-05-11 23:23 TEST.DLL

下面是通过终端用ftp帐号登录的操作

代码: 全选

sam@sam-P13-K01:~$ ftp localhost
Connected to localhost.localdomain.
220 (vsFTPd 2.3.4)
Name (localhost:sam): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxrwxrwx    2 0        0            4096 May 12 10:50 pub
226 Directory send OK.
ftp> cd pub
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rwx------    1 1001     1001        67072 May 11 15:23 TEST.DLL
226 Directory send OK.
ftp> get TEST.DLL
local: TEST.DLL remote: TEST.DLL
200 PORT command successful. Consider using PASV.
550 Failed to open file.
确实证明了vsftpd匿名帐号用的是ftp帐号来登录的,可是不明白,为什么下载不了chown属于ftp:ftp,而且权限为700的文件
gfedcba
帖子: 17
注册时间: 2011-05-12 0:44

Re: vsftpd匿名用户上传的文件无法下载

#10

帖子 gfedcba » 2011-05-12 18:59

如果将TEST.DLL的权限从700改成701,在终端下就可以用get成功下载,真的很奇怪!!!不明白其中逻辑
zhongjia
帖子: 525
注册时间: 2011-02-08 19:49

Re: vsftpd匿名用户上传的文件无法下载

#11

帖子 zhongjia » 2011-05-13 20:11

vsftpd有两种工作方式,如果你用的是虚拟用户方式,那匿名用户就是ftp账户权限,否则不是。
gfedcba
帖子: 17
注册时间: 2011-05-12 0:44

Re: vsftpd匿名用户上传的文件无法下载

#12

帖子 gfedcba » 2011-05-13 23:30

zhongjia 写了:vsftpd有两种工作方式,如果你用的是虚拟用户方式,那匿名用户就是ftp账户权限,否则不是。
匿名用户如果不是ftp权限,那是什么权限?如果不是ftp权限,为什么登陆上去显示的是ftp帐户的家目录???
scutdk
帖子: 299
注册时间: 2009-07-25 19:23

Re: vsftpd匿名用户上传的文件无法下载

#13

帖子 scutdk » 2011-05-15 21:07

楼主研究出来了么,我也很好起

Ubuntu 桌面培训- 全中文官方文档,含汉化截图,提供PDF
gfedcba
帖子: 17
注册时间: 2011-05-12 0:44

Re: vsftpd匿名用户上传的文件无法下载

#14

帖子 gfedcba » 2011-05-16 19:11

scutdk 写了:楼主研究出来了么,我也很好起
还没研究出来,高人请指点
一旦研究出来,我会过来结贴的
回复