在 Ubuntu 上,其实默认并没有安装 SELinux(Ubuntu 默认用的是 AppArmor)。如果你是自己后来安装了 SELinux,可以按下面步骤卸载。
sestatus
或
dpkg -l | grep selinux
如果显示 command not found 或没有相关包,说明没装 SELinux,无需卸载。
sudo setenforce 0
常见包名:
sudo apt remove --purge selinux selinux-basics selinux-policy-default selinux-utils
如果你不确定装了哪些:
sudo apt remove --purge $(dpkg -l | grep selinux | awk '{print $2}')
sudo rm -rf /etc/selinux
Ubuntu 默认使用 AppArmor:
sudo systemctl enable apparmor
sudo systemctl start apparmor
sudo reboot
/etc/default/grub 里有 selinux=1,记得删掉并:sudo update-grub
如果你愿意,可以贴一下:
dpkg -l | grep selinux
我可以帮你精确给出卸载命令。