summaryrefslogtreecommitdiff
path: root/doasedit.8
blob: 6e07de8b14a655bf1b8e342bcbd1b9baff0f04c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
.\"
.\" Copyright (c) 2021 Jesse Smith <jessefrgsmith@yahoo.ca>
.\" Copyright (c) 2022–2026 Thomas Voss <mail@thomasvoss.com>
.\"
.\" 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 .