我想知道如何停止系统-logind,而不是重新启动或激活以后?
我知道systemd服务单元文件有一个参数: restart=,当设置它的值为no或on-failure时,像systemctl stop xxx一样停止该服务,并且该服务不会被重新启动或激活。
但是系统-洛金看起来很特殊吗?我有点困惑
I #systemctl cat systemd-logind
# /usr/lib/systemd/system/systemd-logind.service
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Login Service
Documentation=man:systemd-logind.service(8) man:logind.conf(5)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/logind
Documentation=http://www.freedesktop.org/wiki/Software/systemd/multiseat
Wants=user.slice
After=nss-user-lookup.target user.slice
# Ask for the dbus socket. If running over kdbus, the socket will
# not be actually used.
Wants=dbus.socket
After=dbus.socket
[Service]
ExecStart=/usr/lib/systemd/systemd-logind
Restart=no
RestartSec=0
#BusName=org.freedesktop.login1
CapabilityBoundingSet=CAP_SYS_ADMIN CAP_MAC_ADMIN CAP_AUDIT_CONTROL CAP_CHOWN CAP_KILL CAP_DAC_READ_SEARCH CAP_DAC_OVERRIDE CAP_FOWNER CAP_SYS_TTY_CONFIG
WatchdogSec=1min
# Increase the default a bit in order to allow many simultaneous
# logins since we keep one fd open per session.
LimitNOFILE=16384发布于 2017-06-05 07:27:42
要停止激活服务,正确的命令是systemctl mask ...。这也将防止它在启动时启动。
如果您只想防止当前启动它,请使用systemctl mask --runtime。这意味着当您关闭或重新启动时,该设置将被遗忘。
logind是非常重要的,我预计会中断引导或登录--手头有一个救援磁盘,并知道如何使用它:)。
发布于 2017-12-02 14:06:55
要禁用系统d-logind,您必须屏蔽服务并禁用systemd模块(pam_systemd)。您可以使用以下命令来完成此操作:
systemctl mask systemd-logind.service pam-auth-update
这是相当安全的,我已经做了很多年。
https://unix.stackexchange.com/questions/369247
复制相似问题