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版本的只能使用