Centos下Apache和vsftpd共用一个目录

安装vsftpd服务

配置文件为

/etc/vsftpd/vsftpd.conf

------------------------------------------------------------------------------------------------------

#实体用户登录的设置
#1.与匿名用户相关的信息,在这个种将匿名登录取消
anonymous_enable=NO
#2.与实体用户相关的信息
#可写入,且新增目录,文件权限为775,因为umask为002
local_enable=YES
write_enable=YES
local_umask=002
#
#设置抵挡某些用户登录的项目设置值。注意,下面的文件必须存在
userlist_enable=YES
userlist_deny=YES
userlist_file=/etc/vsftpd.user_list
#
#
#3.与主机有关的设置
use_localtime=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
pam_service_name=vsftpd
listen=YES
tcp_wrappers=YES
banner_file=/etc/vsftpd/welcome.txt
#增加是否针对某些用户来chroot的相关设置
#chroot_local_user=YES 
##chroot_local_user=YES 以后新增的用户都为chroot的,除非该用户被写入chroot_list>
才能不被chroot:
#为no时chroot_list里的用户为被chroot的用户
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

---------------------------------------------------------------------------------------------------------------以上为vsftpd,conf文件

创建用户组  groupadd www

创建用户 useradd -g www -d /var/www -M www

创建密码 passwd www

修改/var/www的属组和属主

chown -hR www /var/www

chgrp -hr www /var/www

这时能进行ftp登录

----------------------------------------------

这时出现能登录上去,不能看见子目录下文件,出现一片空白

提示

Name (localhost:root): www
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
227 Entering Passive Mode (127,0,0,1,72,201).
150 Here comes the directory listing.
226 Transfer done (but failed to open directory).

上网找解决方案为改被动

ftp> passive
Passive mode off.
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
226 Transfer done (but failed to open directory).

又继续找解决方案 说是selinux的问题 

把selinux关闭  两种方法:

1.vim /etc/selinux/config

#SELINUX=enforcing  修改为disabled
SELINUX=disabled

***此种方法需要重新启动服务器

2.     #setenforce 0   不需要重启服务器

  重启vsftpd

登录成功

ftp> dir
227 Entering Passive Mode (127,0,0,1,210,156).
150 Here comes the directory listing.
drwxr-xr-x    2 501      501          4096 Jul 23 22:16 cgi-bin
drwxr-xr-x    3 501      501          4096 Sep 21 16:00 error
drwxr-xr-x    5 501      501          4096 Oct 24 21:39 html
drwxr-xr-x    3 501      501          4096 Oct 01 23:09 icons
drwxr-xr-x   14 501      501          4096 Sep 21 16:00 manual
drwxr-xr-x    2 501      501          4096 Oct 01 23:10 usage
226 Directory send OK.
ftp> exit
221 Goodbye.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值