at 18.09-beta 1.8 kB view raw
1<chapter xmlns="http://docbook.org/ns/docbook" 2 xmlns:xlink="http://www.w3.org/1999/xlink" 3 xmlns:xi="http://www.w3.org/2001/XInclude" 4 version="5.0" 5 xml:id="sec-user-sessions"> 6 <title>User Sessions</title> 7 <para> 8 Systemd keeps track of all users who are logged into the system (e.g. on a 9 virtual console or remotely via SSH). The command <command>loginctl</command> 10 allows querying and manipulating user sessions. For instance, to list all 11 user sessions: 12<screen> 13$ loginctl 14 SESSION UID USER SEAT 15 c1 500 eelco seat0 16 c3 0 root seat0 17 c4 500 alice 18</screen> 19 This shows that two users are logged in locally, while another is logged in 20 remotely. (“Seats” are essentially the combinations of displays and input 21 devices attached to the system; usually, there is only one seat.) To get 22 information about a session: 23<screen> 24$ loginctl session-status c3 25c3 - root (0) 26 Since: Tue, 2013-01-08 01:17:56 CET; 4min 42s ago 27 Leader: 2536 (login) 28 Seat: seat0; vc3 29 TTY: /dev/tty3 30 Service: login; type tty; class user 31 State: online 32 CGroup: name=systemd:/user/root/c3 33 ├─ 2536 /nix/store/10mn4xip9n7y9bxqwnsx7xwx2v2g34xn-shadow-4.1.5.1/bin/login -- 34 ├─10339 -bash 35 └─10355 w3m nixos.org 36</screen> 37 This shows that the user is logged in on virtual console 3. It also lists the 38 processes belonging to this session. Since systemd keeps track of this, you 39 can terminate a session in a way that ensures that all the session’s 40 processes are gone: 41<screen> 42# loginctl terminate-session c3 43</screen> 44 </para> 45</chapter>