Skip to content

Commit 9cdf6d9

Browse files
Add synchronized tabs and fix remaining examples
- Add tabs to `elastic-agent unprivileged` and `elastic-agent privileged` commands - Add `:group: os` and `:sync:` options to synchronize tabs across page - Remove `.exe` extension from Windows examples - Remove extra clarifying text from example descriptions - Add Windows example for user+group installation Co-authored-by: vishaangelova <[email protected]>
1 parent f35413c commit 9cdf6d9

File tree

1 file changed

+59
-12
lines changed

1 file changed

+59
-12
lines changed

reference/fleet/elastic-agent-unprivileged.md

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,56 @@ For any installed {{agent}} you can change the mode that it’s running in by ru
153153

154154
Change mode from privileged to unprivileged:
155155

156+
:::::{tab-set}
157+
:group: os
158+
159+
::::{tab-item} Linux/macOS
160+
:sync: linux
161+
156162
```shell
157163
sudo elastic-agent unprivileged
158164
```
159165

166+
::::
167+
168+
::::{tab-item} Windows
169+
:sync: windows
170+
171+
```shell
172+
elastic-agent unprivileged
173+
```
174+
175+
::::
176+
177+
:::::
178+
160179
Changing to `unprivileged` mode is prevented if the agent is currently enrolled in a policy that includes an integration that requires administrative access, such as the {{elastic-defend}} integration.
161180

162181
Change mode from unprivileged to privileged:
163182

183+
:::::{tab-set}
184+
:group: os
185+
186+
::::{tab-item} Linux/macOS
187+
:sync: linux
188+
164189
```shell
165190
sudo elastic-agent privileged
166191
```
167192

193+
::::
194+
195+
::::{tab-item} Windows
196+
:sync: windows
197+
198+
```shell
199+
elastic-agent privileged
200+
```
201+
202+
::::
203+
204+
:::::
205+
168206
When an agent is running in `unprivileged` mode, if it doesn’t have the right level of privilege to read a data source, you can also adjust the agent’s privileges by adding `elastic-agent-user` to the user group that has privileges to read the data source.
169207

170208
As background, when you run {{agent}} in `unprivileged` mode, one user and one group are created on the host. The same names are used for all operating systems:
@@ -189,25 +227,24 @@ This functionality is in technical preview and may be changed or removed in a fu
189227
In certain cases you may want to install {{agent}} in `unprivileged` mode, with the agent running as a pre-existing user or as part of a pre-existing group. For example, on a Windows system you may have a service account in Active Directory and you’d like {{agent}} to run under that account.
190228

191229
::::{note}
192-
The `--password` parameter is only required on Windows. On Linux and macOS, the `--user` and `--group` parameters are optional:
193-
194-
* If you omit `--user`, {{agent}} uses (or creates) the default unprivileged user (`elastic-agent-user`).
195-
* If you specify only `--group`, the agent runs unprivileged under its default user but with the requested group.
230+
The `--password` parameter is only required on Windows. On Linux and macOS, the `--user` and `--group` parameters are optional. If you omit `--user`, {{agent}} uses (or creates) the default unprivileged user (`elastic-agent-user`). If you specify only `--group`, the agent runs unprivileged under its default user but with the requested group.
196231
::::
197232

198233
To install {{agent}} in `unprivileged` mode as a specific user or group, use the following commands:
199234

200235
:::::{tab-set}
236+
:group: os
201237

202238
::::{tab-item} Linux/macOS
239+
:sync: linux
203240

204-
To install with a specific user (optional—if omitted, the default `elastic-agent-user` is used):
241+
To install with a specific user:
205242

206243
```shell
207244
sudo elastic-agent install --unprivileged --user="username"
208245
```
209246

210-
To install with a specific group (the agent runs under its default user with the specified group):
247+
To install with a specific group:
211248

212249
```shell
213250
sudo elastic-agent install --unprivileged --group="groupname"
@@ -222,19 +259,26 @@ sudo elastic-agent install --unprivileged --user="username" --group="groupname"
222259
::::
223260

224261
::::{tab-item} Windows
262+
:sync: windows
225263

226264
On Windows, the `--password` parameter is required when specifying a custom user account.
227265

228266
To install as a specific user:
229267

230268
```shell
231-
elastic-agent.exe install --unprivileged --user="my.domain\username" --password="mypassword"
269+
elastic-agent install --unprivileged --user="my.domain\username" --password="mypassword"
232270
```
233271

234272
To install as part of a specific group:
235273

236274
```shell
237-
elastic-agent.exe install --unprivileged --group="my.domain\groupname"
275+
elastic-agent install --unprivileged --group="my.domain\groupname"
276+
```
277+
278+
To install with both a specific user and group:
279+
280+
```shell
281+
elastic-agent install --unprivileged --user="my.domain\username" --group="my.domain\groupname" --password="mypassword"
238282
```
239283

240284
::::
@@ -244,16 +288,18 @@ elastic-agent.exe install --unprivileged --group="my.domain\groupname"
244288
Alternatively, if you have {{agent}} already installed with administrative privileges, you can change the agent to use `unprivileged` mode and to run as a specific user or in a specific group.
245289

246290
:::::{tab-set}
291+
:group: os
247292

248293
::::{tab-item} Linux/macOS
294+
:sync: linux
249295

250-
To change to a specific user (optional—if omitted, the default `elastic-agent-user` is used):
296+
To change to a specific user:
251297

252298
```shell
253299
sudo elastic-agent unprivileged --user="username"
254300
```
255301

256-
To change to a specific group (the agent runs under its default user with the specified group):
302+
To change to a specific group:
257303

258304
```shell
259305
sudo elastic-agent unprivileged --group="groupname"
@@ -262,19 +308,20 @@ sudo elastic-agent unprivileged --group="groupname"
262308
::::
263309

264310
::::{tab-item} Windows
311+
:sync: windows
265312

266313
On Windows, the `--password` parameter is required when specifying a custom user account.
267314

268315
To change to a specific user:
269316

270317
```shell
271-
elastic-agent.exe unprivileged --user="my.domain\username" --password="mypassword"
318+
elastic-agent unprivileged --user="my.domain\username" --password="mypassword"
272319
```
273320

274321
To change to a specific group:
275322

276323
```shell
277-
elastic-agent.exe unprivileged --group="my.domain\groupname"
324+
elastic-agent unprivileged --group="my.domain\groupname"
278325
```
279326

280327
::::

0 commit comments

Comments
 (0)