详解linux下的selinux(功能、安全上下文、sebool、setrouble)

selinux功能

1.selinux:
内核级加强型火墙

2.seliux关闭状态:
2.1selinux关闭下的实验效果

vim /etc/vsftpd/vsftpd.conf
anonymous_enable=YES  //控制匿名用户可以登陆
anon_upload_enable=YES //打开匿名用户的上传功能
  • 在/mnt里建立一个文件,直接移动到ftp的默认发布目录里,可以直接进行访问
[root@haha ~]# touch /mnt/westosfile
[root@haha ~]# mv /mnt/westosfile /var/ftp
[root@haha ~]# systemctl start vsftpd
[root@haha ~]# 
[root@haha ~]# lftp 172.25.254.23                                   
lftp 172.25.254.23:~> ls
drwxr-xr-x    2 0        0               6 Aug 12  2018 pub
drwxr-xr-x    2 0        0               6 Feb 24 12:54 rhel8.0
-rw-r--r--    1 0        0               0 Feb 29 07:41 westosfile
lftp 172.25.254.23:/> quit
  • 在/mnt里创建的文件安全上下文显示为空
[root@haha ~]# touch /mnt/westosfile
[root@haha ~]# ls -Z /mnt/westosfile
? /mnt/westosfile
  • 程序的安全上下文也是空的,因为我们的selinux是disabled
[root@haha ~]# ps auxZ | grep vsftpd
-                               root      5916  0.0  0.0  26952   412 ?        Ss   15:56   0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
-                               root      6030  0.0  0.1  12112   960 pts/1    R+   16:06   0:00 grep --color=auto vsftpd
[root@haha ~]# ^C

在这里插入图片描述
2.2 selinux开启下的实验效果

etc/sysconfig/selinux与/etc/selinux/config 区别

  • vim /etc/selinux/config可自行修改为强制、警告和关闭状态。修改后reboot进行重启
    在这里插入图片描述
    == /etc/systemctl/selinux与/etc/selinux/config 两种打开方式都可以,只是我的企业8版本的只能使用

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值