Skip to content

Commit 89ec2eb

Browse files
kilfoylemergify[bot]
authored andcommitted
Add docs for running unprivileged agent as existing user/group (#1505)
* Add docs for running unprivileged agent as existing user/group * fixup (cherry picked from commit bb18297)
1 parent 9c62535 commit 89ec2eb

File tree

2 files changed

+74
-3
lines changed

2 files changed

+74
-3
lines changed

docs/en/ingest-management/commands.asciidoc

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ invoking the wrong binary.
2929
* <<elastic-agent-inspect-command,inspect>>
3030
* <<elastic-agent-install-command,install>>
3131
* <<elastic-agent-otel-command,otel>> [technical preview]
32-
* <<elastic-agent-privileged-command,privileged>> [technical preview]
32+
* <<elastic-agent-privileged-command,privileged>>
3333
* <<elastic-agent-restart-command,restart>>
3434
* <<elastic-agent-run-command,run>>
3535
* <<elastic-agent-status-command,status>>
3636
* <<elastic-agent-uninstall-command,uninstall>>
3737
* <<elastic-agent-upgrade-command,upgrade>>
3838
* <<elastic-agent-logs-command,logs>>
39-
* <<elastic-agent-unprivileged-command,unprivileged>> [technical preview]
39+
* <<elastic-agent-unprivileged-command,unprivileged>>
4040
* <<elastic-agent-version-command,version>>
4141
//* <<elastic-agent-watch-command,watch>>
4242

@@ -823,8 +823,22 @@ tags, you must unenroll the {agent}, then re-enroll it using new tags.
823823
Run {agent} without full superuser privileges.
824824
This option is useful in organizations that limit `root` access on Linux or macOS systems, or `admin` access on Windows systems.
825825
For details and limitations for running {agent} in this mode, refer to {fleet-guide}/elastic-agent-unprivileged.html[Run {agent} without administrative privileges].
826-
826+
+
827827
Note that 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.
828+
+
829+
[technical preview] To run {agent} without superuser privileges as a pre-existing user or group, for instance under an Active Directory account, you can specify the user or group, and the password to use.
830+
+
831+
For example:
832+
+
833+
[source,shell]
834+
----
835+
elastic-agent install --unprivileged --user="my.path\username" --password="mypassword"
836+
----
837+
+
838+
[source,shell]
839+
----
840+
elastic-agent install --unprivileged --group="my.path\groupname" --password="mypassword"
841+
----
828842

829843
`--url <string>`::
830844
{fleet-server} URL to use to enroll the {agent} into {fleet}.
@@ -1177,14 +1191,32 @@ For details and limitations for running {agent} in this mode, refer to {fleet-gu
11771191

11781192
Note that changing a running {agent} to `unprivileged` mode is prevented if the agent is currently enrolled with a policy that contains the {elastic-defend} integration.
11791193

1194+
[technical preview] To run {agent} without superuser privileges as a pre-existing user or group, for instance under an Active Directory account, add either a `--user` or `--group` parameter together with a `--password` parameter.
1195+
11801196
[discrete]
11811197
=== Examples
11821198

1199+
Run {agent} without administrative privileges:
1200+
11831201
[source,shell]
11841202
----
11851203
elastic-agent unprivileged
11861204
----
11871205

1206+
Run {agent} without administrative privileges, as a pre-existing user: [technical preview]
1207+
1208+
[source,shell]
1209+
----
1210+
elastic-agent unprivileged --user="my.pathl\username" --password="mypassword"
1211+
----
1212+
1213+
Run {agent} without administrative privileges, as a pre-existing group: [technical preview]
1214+
1215+
[source,shell]
1216+
----
1217+
elastic-agent unprivileged --group="my.pathl\groupname" --password="mypassword"
1218+
----
1219+
11881220
++++
11891221
<hr>
11901222
++++

docs/en/ingest-management/elastic-agent/elastic-agent-unprivileged-mode.asciidoc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Refer to <<unprivileged-command-behaviors>> and <<unprivileged-running>> for the
1616
* <<unprivileged-integrations>>
1717
* <<unprivileged-view-mode>>
1818
* <<unprivileged-change-mode>>
19+
* <<unprivileged-preexisting-user>>
1920

2021
[discrete]
2122
[[unprivileged-running]]
@@ -227,3 +228,41 @@ For example:
227228
. When you install {agent} with the `--unprivileged` setting, the `elastic-agent-user` user and the `elastic-agent` group are created automatically.
228229
. If you then want your user `myuser` to be able to run an {agent} command such as `elastic-agent status`, add the `myuser` user to the `elastic-agent` group.
229230
. Then, once added to the group, the `elastic-agent status` command will work. Prior to that, the user `myuser` running the command will result in a permission error that indicates a problem communicating with the control socket.
231+
232+
[discrete]
233+
[[unprivileged-preexisting-user]]
234+
== Using `unprivileged` mode with a pre-existing user and group
235+
236+
preview::[]
237+
238+
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.
239+
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.
240+
241+
To install {agent} in `unprivileged` mode as a specific user, add the `--user` and `--password` parameters to the install command:
242+
243+
[source,shell]
244+
----
245+
elastic-agent install --unprivileged --user="my.path\username" --password="mypassword"
246+
----
247+
248+
To install {agent} in `unprivileged` mode as part of a specific group, add the `--group` and `--password` parameters to the install command:
249+
250+
[source,shell]
251+
----
252+
elastic-agent install --unprivileged --group="my.path\groupname" --password="mypassword"
253+
----
254+
255+
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.
256+
For example:
257+
258+
[source,shell]
259+
----
260+
elastic-agent unprivileged --user="my.path\username" --password="mypassword"
261+
----
262+
263+
[source,shell]
264+
----
265+
elastic-agent unprivileged --group="my.path\groupname" --password="mypassword"
266+
----
267+
268+

0 commit comments

Comments
 (0)