0

I see the SELinux context set for almost all the files in the root file system. This is our customized Linux image built from kernel 4.19 with userland packages including systemd service to manage services, docker runtime to run containers.

Note that, the SELinux is not enabled and no configuration exists in /etc/selinux. Even the /etc/selinux is not present.

For example:

# ls -Z /bin/ls
system_u:object_r:admin_home_t:s0 /bin/ls

I am just wondering how is this SELinux context set! Can anyone help to understand who is setting the context?

1 Answer 1

0

Your Linux distro has a way of doing that; on many distro's, that's a bunch of configuration scripts contained in /var/lib/selinux and/or /etc/selinux, and the restorecon utility. Arch and Gentoo have specific tools to apply things to packages.

So, it depends on the way you've built your distro.

4
  • I am not using any existing distros. It is built from scratch kernel + other packages. neither /var/lib/selinux nor /etc/selinux exist. There is no restorecon installed.
    – pitnal
    Commented Feb 29 at 12:29
  • @pitnal well, then you now know what you need to add to your own distro. Have fun! Commented Feb 29 at 13:24
  • no, the question is to understand who is setting it at first place. In my case I want to disable SELinux totally.
    – pitnal
    Commented Mar 1 at 11:04
  • "no, the question is to understand who is setting it at first place" I answered that for usual Linux distros. We can't know what you are doing on your own! Files don't magically get these extended attributes, so whatever you are using to build your filesystem images must have brought that with it. You don't tell us how you build your own system, so we can't even guess what you included to do that. To cite my answer's last sentence: So, it depends on the way you've built your distro. Commented Mar 1 at 11:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .