.\" .\" Copyright (c) 2021 Jesse Smith .\" Copyright (c) 2022–2026 Thomas Voss .\" .\" Permission to use, copy, modify, and distribute this software for .\" any purpose with or without fee is hereby granted, provided that .\" the above copyright notice and this permission notice appear in all .\" copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL .\" WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED .\" WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE .\" AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL .\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA .\" OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER .\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" .Dd Match 25, 2026 .Dt DOASEDIT 8 .Os .Sh NAME .Nm doasedit .Nd edit a text file with root access as a non-root user .Sh SYNOPSIS .Nm .Ar file .Sh DESCRIPTION The .Nm 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. .Pp 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 .Ev VISUAL is not set .Ev EDITOR is tried instead. If both environment variables are not set then .Xr vi(1) is used as a fallback. .Pp By default .Nm will create a temporary file in .Ev TMPDIR . If .Ev TMPDIR is not set it will fallback to using .Pa /tmp . .Pp When editing a file the .Ev DOASEDIT_EDITING environment variable will be set to the absolute path of .Ar file . Editors can use this to ensure that filetype-specific configurations are properly applied. .Sh EXIT STATUS .Ex -std .Sh ENVIRONMENT .Bl -tag -width Ds .It Ev DOASEDIT_EDITING The absolute path to the root-protected file currently being edited. .It Ev EDITOR The editor to use to edit the target text file if .Ev VISUAL is not set. If the .Ev EDITOR variable is not set, then the command .Xr vi 1 is used. .It Ev TMPDIR The directory in which to create the temporary file copy to edit. If the .Ev TMPDIR variable is not set, .Pa /tmp will be used as a fallback. .It Ev VISUAL The editor to use to edit the target text file. If the .Ev VISUAL variable is not set, then .Ev EDTIOR is used as a fallback. .El .Sh SEE ALSO .Xr doas 1 , .Xr vi 1 , .Xr doas.conf 5 , .Xr vidoas 8 .Sh AUTHORS .An -nosplit The .Nm utility and manual page were originally written by .An Jesse Smith Aq Mt jessefrgsmith@yahoo.ca , but are now maintained by .An Thomas Voss Aq Mt mail@thomasvoss.com .