Linux之FTP部署
Linux之FTP部署
1.关闭 selinux
安全增强式Linux(SELinux, Security-Enhanced Linux)是一种强制存取控制(mandatory access control)的实现。
查看selinux状态: getenforce
SELinux 支持三种模式,分别如下:
•enforcing:强制模式,代表 SELinux 运作中,且已经正确的开始限制 domain/type 了;
•permissive:宽容模式:代表 SELinux 运作中,不过仅会有警告讯息并不会实际限制 domain/type 的存取。这种模式可以运来作为 SELinux 的 debug 之用;
www.2cto.com
•disabled:关闭,SELinux 并没有实际运作。
修改/etc/sysconfig/selinux,将其disable:SELINUX=disabled
或者: setsebool ftpd_disable_trans 1
# setsebool -P ftp_home_dir 1
# service vsftpd restart
reboot
2.命令 getsebool ftpd_disable_trans 可以查看当前的状态如果不是on
那么是输入命令 setsebool ftpd_disable_trans 1 当然也可以加入-P参数 以便不需要每次开机都输入这个命令 setsebool -P ftpd_disable_trans 1 同理
如果smb服务也遇到相同的问题
修改/etc/vsftpd/vsftpd.conf
vi /etc/vsftpd/vsftpd.conf
#启用/禁止匿名用户访问
anonymous_enable=NO
#允许本地用户登录并允许其上传文件
local_enable=YES
write_enable=YES
#将本地用户锁定在主目录中,不允许切换到上一级目录中
chroot_local_user=YES
chroot_list_enable=YES
· 新建/etc/vsftpd/chroot_list
vi /etc/vsftpd/chroot_list
加入 www.2cto.com
storage
这样,storage用户登录,可以切换任意路径
否则,会被限制在home目录
· 设置开机自启动:chkconfig vsftpd on
service vsftpd start 开启
service vsftpd sttp 停止
service vsftpd restart 重启
作者 Cloud123
评论暂时关闭