I see people talking about doas saying it’s just like sudo but with less features. I’m just wondering if there is any situation where you should use doas or if it’s just personal preference.

  • matcha_addict@lemy.lol
    link
    fedilink
    arrow-up
    2
    ·
    8 months ago

    The short answer is that my distro did not let me do this easily. But that was for good reason.

    A system update would require too many privileges that it would be almost indistinguishable from root.

    Currently, every user I have is restricted in what files it has access to. A system update user would need access to so many files, including install locations of all binaries, and non-binary installation paths of all current and future programs I install (some package installs modify /var, many modify /etc, and so on).

    This user will also have access to all these programs, down to system applications. It can trivially break a permission system I come up with.

    It may be possible to restrict system updates to a user, but it would be such a powerful user that its not really worth it.

    • Pantherina@feddit.de
      link
      fedilink
      arrow-up
      1
      ·
      8 months ago

      Does the user have that access? In my case with rpm-ostree they can just execute 2 commands rpm-ostree refresh-md (get updates) and rpm-ostree update. rpm-ostree rebase is used for system upgrades afaik, that one needs a password.

      • matcha_addict@lemy.lol
        link
        fedilink
        arrow-up
        1
        ·
        8 months ago

        Only the root user has access to system updates on my system currently.

        What does rpm-ostree update do exactly? Does it execute the update? Or is that the rebase command only?

        • Pantherina@feddit.de
          link
          fedilink
          arrow-up
          1
          ·
          8 months ago

          No rpm-ostree downloads the diffs, applies existing changes (added or removed packages) and builds a new image that gets staged as first boot target. After reboot you are on an updated system.

          • taladar
            link
            fedilink
            arrow-up
            3
            ·
            8 months ago

            If it builds a new image that replaces the entire system it could be compromised to give full access to the entire system just as easily as sudo, possibly more easily.

              • taladar
                link
                fedilink
                arrow-up
                2
                ·
                8 months ago

                The component that is like sudo in this case is polkit. Of course an unprivileged user can be used to run sudo commands as well, limited by the rules in the sudo config file, just as these polkit rules limit what the user can do…as long as there is no security issue in sudo and polkit respectively but the actual work is done by a privileged process that is merely controlled by the commands given by the unprivileged user.

          • matcha_addict@lemy.lol
            link
            fedilink
            arrow-up
            2
            ·
            8 months ago

            I see. I have little knowledge, but I bet that the “root privileges” part of this process is the reboot. Upon rebooting, system updates are applied from the new image via some privileged process.

            That’s pretty neat. Unfortunately I haven’t ventured deeply enough into that type of system yet (was it called immutable distro or something?). I use gentoo, which doesn’t support this out of the box.

            Thanks for showing me something new!

            • Pantherina@feddit.de
              link
              fedilink
              arrow-up
              1
              ·
              8 months ago

              Rebooting does not need root privileges either, on no system. There really is nothing privileged about updating already existing software. Android is completely rootless and updates are automatic, but can be done manually too.

              You can read a bit into OSTree, its very cool. But seems to be very complex and somehow they want to switch to OCI images now, idk.

              But the way ublue builds their systems is astonishing, elegant, simple, structured and fully automated.