当前位置: 移动技术网 > 网络运营>服务器>Linux > 关于linux服务器下vsftpd的一些问题

关于linux服务器下vsftpd的一些问题

2019年05月06日  | 移动技术网网络运营  | 我要评论
前段时间碰到一位牛b的人物,帮我修正了vsftpd基于pam认证的问题.今天又碰到n个问题,比如access denied. 和403错误,无法上传文件等等之类的错误.于是,只好请这个高人再次出马,帮忙再次修正.很感谢这位牛b人物.在利益大于一切的这个x蛋的社会,还能为了咱们这群小菜鸟去分析n个文件..这种精神实在是值得佩服.

针对我自己本身出现的问题,将高人与我的qq聊天记录整理了一份,然后再加上实际的操作.终于让我大彻大悟.现在与大家狠狠的分享这位高人的成果.

用户上传文件访问出现403或者access denied.

解答:这个主要是权限问题,在用户vsftpd.conf中加上:anon_umask=022或者anon_umask=133,022指755权限.133指644权限,再将给权限给该文件chmod 644 xx.php或者chmod 644 name

用户无法上传文件,出现550或者是553错误

可能是用户组有问题.比如你的网站用www这个用户来访问,那么就将vsftpd.conf中的guest_username=xxx改成www

另外贴出来我的vsftpd的配置文件:
复制代码 代码如下:

# 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
#
# 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
#
# 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
#
# 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.
#
# 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_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 whith two configuration files.
# make sure, that one of the listen options is commented !!
#listen_ipv6=yes
pam_service_name=vsftpd
<strong>user_config_dir=/etc/vsftpd/user_config_dir /*基于pam认证用到的*/
userlist_enable=yes
tcp_wrappers=yes
guest_enable=yes
guest_username=www /*注意这里.很有可能是因为你的用户导致你的权限出问题*/
local_root=/home/www
anon_umask=022 /*这里是刚才上面提到的权限问题 */
</strong>

如果你已经是使用了ram认证的.那么你可以参考下我的单个用户的配置.文件如下
复制代码 代码如下:

<strong>anon_world_readable_only=no
write_enable=yes
anon_upload_enable=yes
anon_other_write_enable=yes
local_root=/var/public
anon_mkdir_write_enable=yes
</strong>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网