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

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

 
 
  1. FILE_CONTEXTS 
  2.        SELinux requires files to have 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 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 -
allow_ftpd_anon_write on
 

root@local# chcon -Rt public_content_rw_t
 /var/ftp/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值