文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>简简单单让selinux放过ftp一马,使..

简简单单让selinux放过ftp一马,使..

时间:2010-10-19  来源:rilee

废话不多说,先贴出我们强大的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/

 

排行榜 更多 +
扑击萌兽大逃亡手游下载

扑击萌兽大逃亡手游下载

休闲益智 下载
gate交易平台app免费版

gate交易平台app免费版

金融理财 下载
Uniswap中文版app安卓版

Uniswap中文版app安卓版

金融理财 下载