]> git.armaanb.net Git - opendoas.git/blob - doas.1
mention environment resetting here as well. ok millert
[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, the environment is reset.
43 The variables
44 .Ev HOME ,
45 .Ev LOGNAME ,
46 .Ev PATH ,
47 .Ev SHELL ,
48 and
49 .Ev USER
50 are set to values appropriate for the target user.
51 The variables
52 .Ev DISPLAY
53 and
54 .Ev TERM
55 are inherited from the current environment.
56 This behavior may be modified by the config file.
57 The working directory is not changed.
58 .Pp
59 The options are as follows:
60 .Bl -tag -width tenletters
61 .It Fl C Ar config
62 Parse and check the configuration file
63 .Ar config ,
64 then exit.
65 If
66 .Ar command
67 is supplied,
68 .Nm
69 will also perform command matching.
70 In the latter case
71 either
72 .Sq permit ,
73 .Sq permit nopass
74 or
75 .Sq deny
76 will be printed on standard output, depending on command
77 matching results.
78 No command is executed.
79 .It Fl L
80 Clear any persisted authorizations from previous invocations,
81 then immediately exit.
82 No command is executed.
83 .It Fl n
84 Non interactive mode, fail if
85 .Nm
86 would prompt for password.
87 .It Fl s
88 Execute the shell from
89 .Ev SHELL
90 or
91 .Pa /etc/passwd .
92 .It Fl u Ar user
93 Execute the command as
94 .Ar user .
95 The default is root.
96 .El
97 .Sh EXIT STATUS
98 .Ex -std doas
99 It may fail for one of the following reasons:
100 .Pp
101 .Bl -bullet -compact
102 .It
103 The config file
104 .Pa /etc/doas.conf
105 could not be parsed.
106 .It
107 The user attempted to run a command which is not permitted.
108 .It
109 The password was incorrect.
110 .It
111 The specified command was not found or is not executable.
112 .El
113 .Sh SEE ALSO
114 .Xr su 1 ,
115 .Xr doas.conf 5
116 .Sh HISTORY
117 The
118 .Nm
119 command first appeared in
120 .Ox 5.8 .
121 .Sh AUTHORS
122 .An Ted Unangst Aq Mt tedu@openbsd.org