vsftpd 无法登录
# 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.
#
# If vsftpd is in standalone mode, the default listen address (of all local
# interfaces) may be overridden by this setting. Provide a numeric IP address.
#listen_address=127.0.0.1
#
# 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
#
# Default umask for anonymous users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#anon_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
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
#connect_from_port_20=YES
pasv_enable=YES
pasv_max_port=30000
pasv_min_port=25000
#
# 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=NO
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
#
pam_service_name=vsftpd
#userlist_enable=YES
#userlist_deny=NO
#tcp_wrappers=YES
#userlist_file=/etc/vsftpd/user_list
# When enabled, directory listings reveal the local time for the computer
# instead of GMT.
#
#use_localtime=YES
#
# If set to YES, anonymous users will be permitted to perform write operations
# other than upload and create directory, such as deletion and renaming.
# This is generally not recommended but included for completeness.
#
#anon_other_write_enable=YES
#
# When enabled, anonymous users will only be allowed to download files which
# are world readable. This is recognising that the ftp user may own files,
# especially in the presence of uploads.
#
#anon_world_readable_only=NO
#
# Specifies the lowest possible port sent to the FTP clients for passive mode
# connections. This setting is used to limit the port range so that firewall
# rules are easier to create.
#
#pasv_min_port=30000
#
# Specifies the highest possible port sent to the FTP clients for passive mode
# connections. This setting is used to limit the port range so that firewall
# rules are easier to create.
#
#pasv_max_port=30999
#
# This directive specifies the maximum number of simultaneous clients allowed
# to connect to the server when it is running in standalone mode,
# in bytes per second.
#
max_clients=100
#
# This directive enables maximum of clients allowed to connected from the
# same source IP address.
#
max_per_ip=4
#
# Specifies the maximum data transfer rate for anonymous users in bytes
# per second.
#
#anon_max_rate=0
#
# Specifies the maximum rate data is transfered for local users logged
# into the server in bytes per second.
#
#local_max_rate=0
#
# Enable convert charset
#
#convert_charset_enable=1
#
# Specifies local charset
#
#local_charset=UTF8
#
# Specifies remote charset
#
#remote_charset=CP1251
#
# Enable this options if you have double "я"
#
#double_377=0
新建了ftp用户, abc, home 目录是 /var/www/abc, 权限是755
如果在 /etc/vsftpd/chroot_list 中添加 abc, 则登录超时,如果去掉,则顺利登录,但是目录是 / 而且可以跳转到其他目录。
现在需求是,如何使 abc 能登录且指定目录为 /var/www/abc, 且不能跳转到其他目录?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
lz弄错了个概念,我开始搭建的时候也碰到同样的问题:chroot_list文件里放的用户名是linux系统的用户,一般就是/etc/passwd内可以看到的那些。因为古老的unix还没internet时候是一个主机好多个终端,所以保留了chroot_list里配置同一机器多个用户的功能,现在一般没人这样用了(所以如果看的是鸟哥的linux私房菜的vsftp教程里面就先说的这个方式,就乱了。)。
而ftp的用户应该是在 /etc/vsftpd/vuser_passwd.txt 里配置账户密码,在 /etc/vsftpd/vuser_conf/ftpuser1 这样的配置文件内指定设置。
以下贴上我参考的教程,http://itgeeker.net/centos6-5-64bit-how-to-install-vsftpd/。
vsftp架设(http://itgeeker.net/centos6-5-64bit-how-to-install-vsftpd/)
一、 vsftpd安装
一般在CentOS上都自动安装了vsftd,若没有安装则可以使用以下步骤进行安装
在CentOS中,这样就可以完成了一个简单的匿名FTP的搭建。你可以通过文件资源管理器访问 ftp://YOURIPADDRESS 来进行访问,这个时候你可以看到里面有一个目录“pub”,其它什么都不能干。
二、 vsftpd虚拟用户配置
1.编辑配置文件vi /etc/vsftpd/vsftpd.conf
以下这些是关于Vsftpd虚拟用户支持的重要CentOS FTP服务配置项目。
默认vsftpd.conf中不包含这些设定项目,需要自己手动添加CentOS FTP服务配置。
2. 创建chroot list,将用户ftp加入其中
3. 进行虚拟用户认证配置
安装Berkeley DB工具,后面找不到db_load的问题就是没有安装这个软件包的原因。
然后,创建用户密码文本vuser_passwd.txt。注意奇数行是用户名,偶行是密码
生成虚拟用户认证的db文件
编辑认证文件/etc/pam.d/vsftpd,全部注释掉原来语句,并增加以下两行
现在可以创建虚拟用户个性化FTP服务配置文件
4.建立目录和设定权限
5. 启动vsftp服务
CentOS上的FTP服务假设完毕!!!