0

The question maybe odd but i didn´t find any explanation to it, so:

Sevreral tools for generating rootfs use fakeroot in order to fake the permissions, create the rootfs and then archive it. After that when the archive will be extracted it will be seen by the kernel as having root ownership.

My question is why the linux kernel expects that the rootfs has root ownership?

3
  • What makes you think that the kernel expects this?
    – JdeBP
    Commented Oct 10, 2017 at 5:11
  • @JdeBP, because if the ownership of the rootfs is different than root, the kernel will fail to mount it.
    – Mouin
    Commented Oct 10, 2017 at 7:04
  • The vanilla kernel has no such restriction, to my knowledge. So again: What makes you think that the kernel expects this? What error message have you seen, and where?
    – JdeBP
    Commented Oct 10, 2017 at 10:12

1 Answer 1

1

Because otherwise the owner of the root directory would be able to escalate privileges to root, f.i. by renaming /etc and creating a new one, and a new /etc/passwd.

2
  • I am not sure to understand, but what i mean is that the kernel fails to mount the rootfs if it s not root
    – Mouin
    Commented Oct 10, 2017 at 7:26
  • You asked why does the kernel do that, I gave you a plausible reason. Is that the definitive answer? No idea, you'll have to ask Linus for that. shrug Commented Oct 10, 2017 at 7:30

You must log in to answer this question.

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