On 11/7/21 21:19, tempforever wrote:
[snip]> Actually I'll probably switch to a text-based editor for this
particular
case, but in general, for GUI applications, how is this done now?
[snip]

You could consider running sudoedit instead.  That will allow you to
edit a file as root (or any other designated account) while still
running the editor itself under the unprivileged account.  One should
not run graphical programs as root, if it can be avoided.

From the manual page for sudo:

        When invoked as sudoedit, the -e option (described
        below), is implied.
        [...]
        -e, --edit  Edit one or more files instead of running a
                command.  In lieu of a path name, the string
                "sudoedit" is used when consultimg the security
                policy.  If the user is authorized by the pol‐
                icy, the following steps are taken:

                1.   Temporary copies are made of the files to
                        be edited with the owner set to the
                        invoking user.

                2.   The editor specified by the policy is run to
                        edit the temporary files.  The sudoers
                        policy uses the SUDO_EDITOR, VISUAL and
                        EDITOR environment variables (in that order).
                        If none of SUDO_EDITOR, VISUAL or EDITOR
                        are set, the first program listed in the editor
                        sudoers(5) option is used.

                3.   If they have been modified, the temporary files are
                        copied back to their original location and
                        the temporary versions are removed.

                To help prevent the editing of unauthorized files,
                the following restrictions are enforced unless [...]

There a lot more about that in the manual pages.  See "man sudo" and
"man sudoers"

/Lars
_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to