Chinaunix首页 | 论坛 | 博客
  • 博客访问: 53682
  • 博文数量: 11
  • 博客积分: 606
  • 博客等级: 上士
  • 技术积分: 120
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-31 22:16
文章分类
文章存档

2011年(1)

2010年(10)

分类: LINUX

2010-10-19 23:30:19

废话不多说,先贴出我们强大的man文档:

  1. FILE_CONTEXTS 
  2.        SELinux requires files to have a file type. File types may be specified 
  3.        with  semanage  and  are  restored with restorecon.  Policy governs the 
  4.        access that daemons have to files. 
  5.  
  6.        Allow ftp servers to read the /var/ftp directory  by  adding  the  public_content_t  file  type  to  the  directory and by restoring the file 
  7.        type. 
  8.  
  9.        semanage fcontext -a -t public_content_t "/var/ftp(/.*)?" 
  10.  
  11.        restorecon -R -v /var/ftp 
  12.  
  13.        Allow ftp servers to read and write  /var/tmp/incoming  by  adding  the 
  14.        public_content_rw_t  type  to  the  directory and by restoring the file 
  15.        type.  This also requires the allow_ftpd_anon_write boolean to be  set. 
  16.  
  17.        semanage fcontext -a -t public_content_rw_t "/var/ftp/incoming(/.*)?" 
  18.   /× chcon -Rt public_content_rw_t /var/ftp/ 一样的!!×/
  19.        restorecon -R -v /var/ftp/incoming 
  20.  
  21.  
  22. BOOLEANS 
  23.        SELinux policy is based on least privilege required  and  may  also  be 
  24.        customizable by setting a boolean with setsebool. 
  25.  
  26.        Allow  ftp servers to read and write files with the public_content_rw_t 
  27.        file type. 
  28.  
  29.        setsebool -P allow_ftpd_anon_write on 
  30.  
  31.        Allow  ftp servers to read or write files in the user home directories. 
  32.  
  33.        setsebool -P ftp_home_dir on 
  34.  
  35.        Allow ftp servers to read or write all files on the system. 
  36.  
  37.        setsebool -P allow_ftpd_full_access on 
  38.  
  39.        Allow ftp servers to use cifs for public file transfer services. 
  40.  
  41.        setsebool -P allow_ftpd_use_cifs on 
  42.  
  43.        Allow ftp servers to use nfs for public file transfer services. 
  44.  
  45.        setsebool -P allow_ftpd_use_nfs on 


参考上面的文档,在vsftpd本身配置没有问题的情况下,只需要如下两个命令就搞定ftp上传咯:

root@local# setsebool -P allow_ftpd_anon_write on
 

root@local# chcon -Rt public_content_rw_t /var/ftp/

阅读(1504) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-10-20 10:45:34

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com