Skip to content

Commit bd28046

Browse files
hc-github-team-nomad-coretemppkazmierczak
authored
Backport of docs: emphasize HOME and USER env vars for tasks that use custom user setting into release/1.9.x (#25887)
* no-op commit due to failed cherry-picking * docs: emphasize HOME and USER env vars for tasks that use custom `user` setting (#25879) In #25859 we fixed the task environment variables to account for user field setting. This PR follows up with documentation adjustments. --------- Co-authored-by: temp <[email protected]> Co-authored-by: Piotr Kazmierczak <[email protected]>
1 parent ae32b16 commit bd28046

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

website/content/docs/job-specification/task.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,13 @@ job "docs" {
107107

108108
- `user` `(string: <varies>)` - Specifies the user that will run the task.
109109
Defaults to `nobody` for the [`exec`][exec] and [`java`][java] drivers.
110-
[Docker][] images specify their own default users. This can only be set
111-
on Linux platforms, and clients can restrict [which drivers][user_drivers]
112-
are allowed to run tasks as [certain users][user_denylist].
110+
[Docker][] images specify their own default users. Clients can restrict
111+
[which drivers][user_drivers] are allowed to run tasks as [certain
112+
users][user_denylist]. On UNIX-like systems, setting `user` also affects
113+
the environment variables `HOME` and `USER` available to the task. On
114+
Windows, when Nomad is running as a [system service][service] for the
115+
[`raw_exec`][raw_exec] driver, you may specify a less-privileged service user.
116+
For example, `NT AUTHORITY\LocalService`, `NT AUTHORITY\NetworkService`.
113117

114118
- `template` <code>([Template][]: nil)</code> - Specifies the set of templates
115119
to render for the task. Templates can be used to inject both static and

website/content/docs/runtime/environment.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ description: Nomad provides runtime environment variables that you can use in yo
77
# Runtime Environment Settings
88

99
This page provides reference information for runtime environment settings in
10-
your Nomad job specification. Learn about task identifiers, CPU and memory resources, IP addresses, task directories, and host variables. Review job, network, and Consul variables. Supply arbitrary configuration to a job task.
10+
your Nomad job specification. Learn about task identifiers, CPU and memory
11+
resources, IP addresses, task directories, and host variables. Review job,
12+
network, and Consul variables. Supply arbitrary configuration to a job task.
1113

1214
## Introduction
1315

@@ -108,10 +110,11 @@ behavior.
108110

109111
## Host environment variables
110112

111-
Nomad passes the environment variables defined in the client host to tasks when
112-
using the `exec`, `raw_exec`, and `java` task drivers. The variables that are
113-
passed to the tasks can be controlled using the client configuration
114-
[`env.denylist`][].
113+
Nomad passes the environment variables defined in the client host to tasks
114+
when using the `exec`, `raw_exec`, and `java` task drivers. Nomad also modifies
115+
`HOME` and `USER` variables for tasks that have the `user` parameter set, to
116+
reflect the set username. The variables that are passed to the tasks can be
117+
controlled using the client configuration [`env.denylist`][].
115118

116119
[jobspec]: /nomad/docs/job-specification 'Nomad Job Specification'
117120
[filesystem internals]: /nomad/docs/concepts/filesystem

0 commit comments

Comments
 (0)