]> git.armaanb.net Git - opendoas.git/blob - doas.1
tweak wording a bit. always talk about creating a new environment. also document...
[opendoas.git] / doas.1
1 .\" $OpenBSD: doas.1,v 1.13 2015/07/26 23:00:15 tedu Exp $
2 .\"
3 .\"Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
4 .\"
5 .\"Permission to use, copy, modify, and distribute this software for any
6 .\"purpose with or without fee is hereby granted, provided that the above
7 .\"copyright notice and this permission notice appear in all copies.
8 .\"
9 .\"THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\"WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\"MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\"ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\"ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\"OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 .Dd $Mdocdate: July 26 2015 $
17 .Dt DOAS 1
18 .Os
19 .Sh NAME
20 .Nm doas
21 .Nd execute commands as another user
22 .Sh SYNOPSIS
23 .Nm doas
24 .Op Fl Lns
25 .Op Fl C Ar config
26 .Op Fl u Ar user
27 .Ar command
28 .Op Ar args
29 .Sh DESCRIPTION
30 The
31 .Nm
32 utility executes the given command as another user.
33 The
34 .Ar command
35 argument is mandatory unless
36 .Fl C ,
37 .Fl L ,
38 or
39 .Fl s
40 is specified.
41 .Pp
42 By default, a new environment is created.
43 The variables
44 .Ev HOME ,
45 .Ev LOGNAME ,
46 .Ev PATH ,
47 .Ev SHELL ,
48 and
49 .Ev USER
50 and the
51 .Xr umask 2
52 are set to values appropriate for the target user.
53 .Ev DOAS_USER
54 is set to the name of the user executing
55 .Nm .
56 The variables
57 .Ev DISPLAY
58 and
59 .Ev TERM
60 are inherited from the current environment.
61 This behavior may be modified by the config file.
62 The working directory is not changed.
63 .Pp
64 The options are as follows:
65 .Bl -tag -width tenletters
66 .It Fl C Ar config
67 Parse and check the configuration file
68 .Ar config ,
69 then exit.
70 If
71 .Ar command
72 is supplied,
73 .Nm
74 will also perform command matching.
75 In the latter case
76 either
77 .Sq permit ,
78 .Sq permit nopass
79 or
80 .Sq deny
81 will be printed on standard output, depending on command
82 matching results.
83 No command is executed.
84 .It Fl L
85 Clear any persisted authorizations from previous invocations,
86 then immediately exit.
87 No command is executed.
88 .It Fl n
89 Non interactive mode, fail if
90 .Nm
91 would prompt for password.
92 .It Fl s
93 Execute the shell from
94 .Ev SHELL
95 or
96 .Pa /etc/passwd .
97 .It Fl u Ar user
98 Execute the command as
99 .Ar user .
100 The default is root.
101 .El
102 .Sh EXIT STATUS
103 .Ex -std doas
104 It may fail for one of the following reasons:
105 .Pp
106 .Bl -bullet -compact
107 .It
108 The config file
109 .Pa /etc/doas.conf
110 could not be parsed.
111 .It
112 The user attempted to run a command which is not permitted.
113 .It
114 The password was incorrect.
115 .It
116 The specified command was not found or is not executable.
117 .El
118 .Sh SEE ALSO
119 .Xr su 1 ,
120 .Xr doas.conf 5
121 .Sh HISTORY
122 The
123 .Nm
124 command first appeared in
125 .Ox 5.8 .
126 .Sh AUTHORS
127 .An Ted Unangst Aq Mt tedu@openbsd.org