selinux的管理

显示及更改selinux模式

   1.selinux两种模式

       *getenforce

       *setenforce  0                            ##表示permissive,警告(同意并警告)

                            1                             ##表示enforcing,强制(拒绝并警告)

   2.更改selinux开机状态

      vim   /etc/sysconfig/selinux

          SELINUX=enforcing

   3.reboot重启

   4.显示上下文

      例如:

      ls -Z  /var/ftp/pub

      ps auxZ  |grep vsftpd

   5.修改安全上下文

     一次性修改:chcon  -t                                  ##执行restorecon刷新后还原

    永久修改:semanage fcontext

    **例如:semanage fcontext  -a -t public_content_t '/westos(/.*)?' 

   6.管理selinux布尔值

[root@localhost ~]# setsebool -P ftp_home_dir 1               ##打开上传权限
[root@localhost ~]# getsebool -a |grep ftp
ftp_home_dir --> on

[root@localhost ~]# chmod u+w /home/student
[root@localhost ~]# lftp 172.25.254.140 -u student
Password:
lftp student@172.25.254.140:~> put /etc/passwd
2050 bytes transferred                         
lftp student@172.25.254.140:~> ls
-rw-r--r--    1 0        0               0 Apr 23 03:26 file
-rw-r--r--    1 1000     1000         2050 Apr 29 02:12 passw

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值