DOASEDIT(8) System Manager's Manual DOASEDIT(8)

doaseditedit a text file with root access as a non-root user

doasedit file

The doasedit utility opens an editor on a temporary copy of a text file. Once the file has been altered, it is written back to the original location, using doas for elevated access. This is intended for use in editing configuration files where the user may need to be root to edit a file, but does not wish to run their text editor as the super user.

The doasedit utility accepts one argument, the file to be edited. The text editor used during the editing process is set using the VISUAL environment variable. If VISUAL is not set EDITOR is tried instead. If both environment variables are not set then vi(1) is used as a fallback.

By default doasedit will create a temporary file in TMPDIR. If TMPDIR is not set it will fallback to using /tmp.

When editing a file the DOASEDIT_EDITING environment variable will be set to the absolute path of file. Editors can use this to ensure that filetype-specific configurations are properly applied.

The doasedit utility exits 0 on success, and >0 if an error occurs.

The absolute path to the root-protected file currently being edited.
The editor to use to edit the target text file if VISUAL is not set. If the EDITOR variable is not set, then the command vi(1) is used.
The directory in which to create the temporary file copy to edit. If the TMPDIR variable is not set, /tmp will be used as a fallback.
The editor to use to edit the target text file. If the VISUAL variable is not set, then EDTIOR is used as a fallback.

doas(1), vi(1), doas.conf(5), vidoas(8)

The doasedit utility and manual page were originally written by Jesse Smith <jessefrgsmith@yahoo.ca>, but are now maintained by Thomas Voss <mail@thomasvoss.com>.

Match 25, 2026 Void Linux