table of contents
LOGINCTL(1) | loginctl | LOGINCTL(1) |
NAME¶
loginctl - Control the systemd login manager
SYNOPSIS¶
loginctl [OPTIONS...] {COMMAND} [NAME...]
DESCRIPTION¶
loginctl may be used to introspect and control the state of the systemd(1) login manager systemd-logind.service(8).
COMMANDS¶
The following commands are understood:
Session Commands¶
list-sessions
session-status [ID...]
Added in version 233.
show-session [ID...]
Added in version 233.
activate [ID]
Added in version 219.
lock-session [ID...], unlock-session [ID...]
Added in version 233.
lock-sessions, unlock-sessions
Added in version 188.
terminate-session ID...
Added in version 233.
kill-session ID...
Added in version 233.
User Commands¶
list-users
user-status [USER...]
Added in version 233.
show-user [USER...]
Added in version 233.
enable-linger [USER...], disable-linger [USER...]
See also KillUserProcesses= setting in logind.conf(5).
Added in version 233.
terminate-user USER...
Added in version 233.
kill-user USER...
Added in version 233.
Seat Commands¶
list-seats
seat-status [NAME...]
Added in version 233.
show-seat [NAME...]
Added in version 233.
attach NAME DEVICE...
Added in version 233.
flush-devices
terminate-seat NAME...
Added in version 233.
OPTIONS¶
The following options are understood:
--no-ask-password
-p, --property=
--value
Added in version 230.
-a, --all
-l, --full
Added in version 198.
--kill-whom=
Added in version 252.
-s, --signal=
The special value "help" will list the known values and the program will exit immediately, and the special value "list" will list known values along with the numerical signal numbers and the program will exit immediately.
-n, --lines=
Added in version 219.
-o, --output=
Added in version 219.
-H, --host=
-M, --machine=
--no-pager
--no-legend
--json=MODE
-j
-h, --help
--version
EXIT STATUS¶
On success, 0 is returned, a non-zero failure code otherwise.
EXAMPLES¶
Example 1. Querying user status
$ loginctl user-status fatima (1005)
Since: Sat 2016-04-09 14:23:31 EDT; 54min ago
State: active
Sessions: 5 *3
Unit: user-1005.slice
├─user@1005.service
...
├─session-3.scope
...
└─session-5.scope
├─3473 login -- fatima
└─3515 -zsh Apr 09 14:40:30 laptop login[2325]: pam_unix(login:session):
session opened for user fatima by LOGIN(uid=0) Apr 09 14:40:30 laptop login[2325]: LOGIN ON tty3 BY fatima
There are two sessions, 3 and 5. Session 3 is a graphical session, marked with a star. The tree of processing including the two corresponding scope units and the user manager unit are shown.
ENVIRONMENT¶
$SYSTEMD_LOG_LEVEL
$SYSTEMD_LOG_COLOR
This setting is only useful when messages are written directly to the terminal, because journalctl(1) and other tools that display logs will color messages based on the log level on their own.
$SYSTEMD_LOG_TIME
This setting is only useful when messages are written directly to the terminal or a file, because journalctl(1) and other tools that display logs will attach timestamps based on the entry metadata on their own.
$SYSTEMD_LOG_LOCATION
Note that the log location is often attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs.
$SYSTEMD_LOG_TID
Note that the this information is attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs.
$SYSTEMD_LOG_TARGET
$SYSTEMD_LOG_RATELIMIT_KMSG
$SYSTEMD_PAGER
Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER (as well as $PAGER) will be silently ignored.
$SYSTEMD_LESS
Users might want to change two options in particular:
K
If the value of $SYSTEMD_LESS does not include "K", and the pager that is invoked is less, Ctrl+C will be ignored by the executable, and needs to be handled by the pager.
X
Note that setting the regular $LESS environment variable has no effect for less invocations by systemd tools.
See less(1) for more discussion.
$SYSTEMD_LESSCHARSET
Note that setting the regular $LESSCHARSET environment variable has no effect for less invocations by systemd tools.
$SYSTEMD_PAGERSECURE
Note: when commands are invoked with elevated privileges, for example under sudo(8) or pkexec(1), care must be taken to ensure that unintended interactive features are not enabled. "Secure" mode for the pager may be enabled automatically as describe above. Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited environment allows the user to invoke arbitrary commands. Note that if the $SYSTEMD_PAGER or $PAGER variables are to be honoured, $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to completely disable the pager using --no-pager instead.
$SYSTEMD_COLORS
$SYSTEMD_URLIFY
SEE ALSO¶
systemd(1), systemctl(1), systemd-logind.service(8), logind.conf(5)
systemd 256.8 |