1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
'\" t
.TH "USER@\&.SERVICE" "5" "" "systemd 241" "user@.service"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
user@.service, user-runtime-dir@.service \- System units to manage user processes
.SH "SYNOPSIS"
.PP
user@\fIUID\fR\&.service
.PP
user\-runtime\-dir@\fIUID\fR\&.service
.PP
user\-\fIUID\fR\&.slice
.SH "DESCRIPTION"
.PP
The
\fBsystemd\fR(1)
system manager (PID 1) starts user manager instances as
user@\fIUID\fR\&.service, where the user\*(Aqs numerical UID is used as the instance identifier\&. Each
\fBsystemd \-\-user\fR
instance manages a hierarchy of its own units\&. See
\fBsystemd\fR(1)
for a discussion of systemd units and
\fBsystemd.special\fR(1)
for a list of units that form the basis of the unit hierarchies of system and user units\&.
.PP
user@\fIUID\fR\&.service
is accompanied by the system unit
user\-runtime\-dir@\fIUID\fR\&.service, which creates the user\*(Aqs runtime directory
/run/user/\fIUID\fR, and then removes it when this unit is stopped\&.
.PP
User processes may be started by the
user@\&.service
instance, in which case they will be part of that unit in the system hierarchy\&. They may also be started elsewhere, for example by
\fBsshd\fR(8)
or a display manager like
\fBgdm\fR, in which case they form a \&.scope unit (see
\fBsystemd.scope\fR(5))\&. Both
user@\fIUID\fR\&.service
and the scope units are collected under a
user\-\fIUID\fR\&.slice\&.
.PP
Individual
user\-\fIUID\fR\&.slice
slices are collected under
user\&.slice, see
\fBsystemd.special\fR(8)\&.
.SH "CONTROLLING RESOURCES FOR LOGGED\-IN USERS"
.PP
Options that control resources available to logged\-in users can be configured at a few different levels\&. As described in the previous section,
user\&.slice
contains processes of all users, so any resource limits on that slice apply to all users together\&. The usual way to configure them would be through drop\-ins, e\&.g\&.
/etc/systemd/system/user\&.slice\&.d/resources\&.conf\&.
.PP
The processes of a single user are collected under
user\-\fIUID\fR\&.slice\&. Resource limits for that user can be configured through drop\-ins for that unit, e\&.g\&.
/etc/systemd/system/user\-1000\&.slice\&.d/resources\&.conf\&. If the limits should apply to all users instead, they may be configured through drop\-ins for the truncated unit name,
user\-\&.slice\&. For example, configuration in
/etc/systemd/system/user\-\&.slice\&.d/resources\&.conf
is included in all
user\-\fIUID\fR\&.slice
units, see
\fBsystemd.unit\fR(5)
for a discussion of the drop\-in mechanism\&.
.PP
When a user logs in and a \&.scope unit is created for the session (see previous section), the creation of the scope may be managed through
\fBpam_systemd\fR(8)\&. This PAM module communicates with
\fBsystemd-logind\fR(8)
to create the session scope and provide access to hardware resources\&. Resource limits for the scope may be configured through the PAM module configuration, see
\fBpam_systemd\fR(8)\&. Configuring them through the normal unit configuration is also possible, but since the name of the slice unit is generally unpredictable, this is less useful\&.
.PP
In general any resources that apply to units may be set for
user@\fIUID\fR\&.service
and the slice units discussed above, see
\fBsystemd.resource-control\fR(5)
for an overview\&.
.SH "EXAMPLES"
.PP
\fBExample\ \&1.\ \&Hierarchy of control groups with two logged in users\fR
.sp
.if n \{\
.RS 4
.\}
.nf
$ systemd\-cgls
Control group /:
\-\&.slice
├─user\&.slice
│ ├─user\-1000\&.slice
│ │ ├─user@1000\&.service
│ │ │ ├─pulseaudio\&.service
│ │ │ │ └─2386 /usr/bin/pulseaudio \-\-daemonize=no
│ │ │ └─gnome\-terminal\-server\&.service
│ │ │ └─init\&.scope
│ │ │ ├─ 4127 /libexec/gnome\-terminal\-server
│ │ │ └─ 4198 zsh
│ │ \&...
│ │ └─session\-4\&.scope
│ │ ├─ 1264 gdm\-session\-worker [pam/gdm\-password]
│ │ ├─ 2339 /usr/bin/gnome\-shell
│ │ \&...
│ │ ├─session\-19\&.scope
│ │ ├─6497 sshd: zbyszek [priv]
│ │ ├─6502 sshd: zbyszek@pts/6
│ │ ├─6509 \-zsh
│ │ └─6602 systemd\-cgls \-\-no\-pager
│ \&...
│ └─user\-1001\&.slice
│ ├─session\-20\&.scope
│ │ ├─6675 sshd: guest [priv]
│ │ ├─6708 sshd: guest@pts/6
│ │ └─6717 \-bash
│ └─user@1001\&.service
│ ├─init\&.scope
│ │ ├─6680 /lib/systemd/systemd \-\-user
│ │ └─6688 (sd\-pam)
│ └─sleep\&.service
│ └─6706 /usr/bin/sleep 30
\&...
.fi
.if n \{\
.RE
.\}
.PP
User with UID 1000 is logged in using
\fBgdm\fR
(session\-4\&.scope) and
\fBssh\fR(1)
(session\-19\&.scope), and also has a user manager instance running (user@1000\&.service)\&. User with UID 1001 is logged in using
\fBssh\fR
(session\-20\&.scope) and also has a user manager instance running (user@1001\&.service)\&. Those are all (leaf) system units, and form part of the slice hierarchy, with
user\-1000\&.slice
and
user\-1001\&.slice
below
user\&.slice\&. User units are visible below the
user@\&.service
instances (pulseaudio\&.service,
gnome\-terminal\-server\&.service,
init\&.scope,
sleep\&.service)\&.
.PP
\fBExample\ \&2.\ \&Default user resource limits\fR
.sp
.if n \{\
.RS 4
.\}
.nf
$ systemctl cat user\-1000\&.slice
# /lib/systemd/system/user\-\&.slice\&.d/10\-defaults\&.conf
# \&...
[Unit]
Description=User Slice of UID %j
After=systemd\-user\-sessions\&.service
[Slice]
TasksMax=33%
.fi
.if n \{\
.RE
.\}
.PP
The
user\-\fIUID\fR\&.slice
units by default don\*(Aqt have a unit file\&. The resource limits are set through a drop\-in, which can be easily replaced or extended following standard drop\-in mechanisms discussed in the first section\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemd.service\fR(5),
\fBsystemd.slice\fR(5),
\fBsystemd.resource-control\fR(5),
\fBsystemd.exec\fR(5),
\fBsystemd.special\fR(7),
\fBpam\fR(8)
|