man-pages/man5/user@.service.5.html
2021-03-31 01:06:50 +01:00

254 lines
7.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of <A HREF="mailto:USER@.SERVICE">USER@.SERVICE</A></TITLE>
</HEAD><BODY>
<H1><A HREF="mailto:USER@.SERVICE">USER@.SERVICE</A></H1>
Section: <A HREF="mailto:user@.service">user@.service</A> (5)<BR>Updated: <BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
<A HREF="mailto:user@.service">user@.service</A>, <A HREF="mailto:user-runtime-dir@.service">user-runtime-dir@.service</A> - System units to manage user processes
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
user@<I>UID</I>.service
<P>
user-runtime-dir@<I>UID</I>.service
<P>
user-<I>UID</I>.slice
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
The
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1)
system manager (PID 1) starts user manager instances as
user@<I>UID</I>.service, where the user's numerical UID is used as the instance identifier. Each
<B>systemd --user</B>
instance manages a hierarchy of its own units. See
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1)
for a discussion of systemd units and
<B><A HREF="/cgi-bin/man/man2html?7+systemd.special">systemd.special</A></B>(7)
for a list of units that form the basis of the unit hierarchies of system and user units.
<P>
user@<I>UID</I>.service
is accompanied by the system unit
user-runtime-dir@<I>UID</I>.service, which creates the user's runtime directory
/run/user/<I>UID</I>, and then removes it when this unit is stopped.
<P>
User processes may be started by the
<A HREF="mailto:user@.service">user@.service</A>
instance, in which case they will be part of that unit in the system hierarchy. They may also be started elsewhere, for example by
<B><A HREF="/cgi-bin/man/man2html?8+sshd">sshd</A></B>(8)
or a display manager like
<B>gdm</B>, in which case they form a .scope unit (see
<B><A HREF="/cgi-bin/man/man2html?5+systemd.scope">systemd.scope</A></B>(5)). Both
user@<I>UID</I>.service
and the scope units are collected under a
user-<I>UID</I>.slice.
<P>
Individual
user-<I>UID</I>.slice
slices are collected under
user.slice, see
<B><A HREF="/cgi-bin/man/man2html?7+systemd.special">systemd.special</A></B>(7).
<A NAME="lbAE">&nbsp;</A>
<H2>CONTROLLING RESOURCES FOR LOGGED-IN USERS</H2>
<P>
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.
<P>
The processes of a single user are collected under
user-<I>UID</I>.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-<I>UID</I>.slice
units, see
<B><A HREF="/cgi-bin/man/man2html?5+systemd.unit">systemd.unit</A></B>(5)
for a discussion of the drop-in mechanism.
<P>
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
<B><A HREF="/cgi-bin/man/man2html?8+pam_systemd">pam_systemd</A></B>(8). This PAM module communicates with
<B><A HREF="/cgi-bin/man/man2html?8+systemd-logind">systemd-logind</A></B>(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
<B><A HREF="/cgi-bin/man/man2html?8+pam_systemd">pam_systemd</A></B>(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.
<P>
In general any resources that apply to units may be set for
user@<I>UID</I>.service
and the slice units discussed above, see
<B><A HREF="/cgi-bin/man/man2html?5+systemd.resource-control">systemd.resource-control</A></B>(5)
for an overview.
<A NAME="lbAF">&nbsp;</A>
<H2>EXAMPLES</H2>
<P>
<B>Example&nbsp;1.&nbsp;Hierarchy of control groups with two logged in users</B>
<P>
<DL COMPACT><DT id="1"><DD>
<PRE>
$ systemd-cgls
Control group /:
-.slice
├─user.slice
│ ├─user-1000.slice
│ │ ├─<A HREF="mailto:user@1000.service">user@1000.service</A>
│ │ │ ├─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
│ └─<A HREF="mailto:user@1001.service">user@1001.service</A>
│ ├─init.scope
│ │ ├─6680 /lib/systemd/systemd --user
│ │ └─6688 (sd-pam)
│ └─sleep.service
│ └─6706 /usr/bin/sleep 30
...
</PRE>
</DL>
<P>
User with UID 1000 is logged in using
<B>gdm</B>
(session-4.scope) and
<B><A HREF="/cgi-bin/man/man2html?1+ssh">ssh</A></B>(1)
(session-19.scope), and also has a user manager instance running (<A HREF="mailto:user@1000.service">user@1000.service</A>). User with UID 1001 is logged in using
<B>ssh</B>
(session-20.scope) and also has a user manager instance running (<A HREF="mailto:user@1001.service">user@1001.service</A>). 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
<A HREF="mailto:user@.service">user@.service</A>
instances (pulseaudio.service,
gnome-terminal-server.service,
init.scope,
sleep.service).
<P>
<B>Example&nbsp;2.&nbsp;Default user resource limits</B>
<P>
<DL COMPACT><DT id="2"><DD>
<PRE>
$ 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%
</PRE>
</DL>
<P>
The
user-<I>UID</I>.slice
units by default don't 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.
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?5+systemd.service">systemd.service</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?5+systemd.slice">systemd.slice</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?5+systemd.resource-control">systemd.resource-control</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?5+systemd.exec">systemd.exec</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?7+systemd.special">systemd.special</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?8+pam">pam</A></B>(8)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="3"><A HREF="#lbAB">NAME</A><DD>
<DT id="4"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="5"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="6"><A HREF="#lbAE">CONTROLLING RESOURCES FOR LOGGED-IN USERS</A><DD>
<DT id="7"><A HREF="#lbAF">EXAMPLES</A><DD>
<DT id="8"><A HREF="#lbAG">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:06 GMT, March 31, 2021
</BODY>
</HTML>