• ghu
    link
    fedilink
    arrow-up
    8
    arrow-down
    1
    ·
    7 months ago

    Does it give alternative to sudo -e (sudoedit) too?

    • Brunacho@scribe.disroot.org
      link
      fedilink
      English
      arrow-up
      4
      ·
      7 months ago

      i had the same question so I went through the source code and, for now, doesn’t seem like it has implemented such option.

    • NekkoDroid@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      7 months ago

      As the other comment said, no. But I’ve had the idea and will to at some point write a edit script (that I can just set EDITOR= to) that would just choose one of the first common editors. That could in theory have a -0 option to run as root (there also probably looking through run0, doas, sudo and su). Not the editor, but doing the editing on a temp file and then copying with root

    • kevincoxM
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      7 months ago

      Out of the box no. But it would be easy to implement if you don’t need very complex rules. (I don’t actually know how permissions work for sudoedit.)

      • bamboo@lemm.ee
        link
        fedilink
        arrow-up
        3
        ·
        7 months ago

        sudoedit copies a file to a temp directory, invokes $EDITOR with that temp file, and after the editor process exits, it copies the file back to overwrite the original. This way you get your user preferred and configured editor, but it doesn’t have any elevated privileges.

        • kevincoxM
          link
          fedilink
          arrow-up
          1
          ·
          7 months ago

          Yes, but how do you configure who is allowed to edit which files in /etc/sudoers?