linux:systemd 禁用ctrl-alt-del centos8及以上

[root@Jenkins system]# cat ./reboot.target
#  SPDX-License-Identifier: LGPL-2.1+
#
#  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=Reboot
Documentation=man:systemd.special(7)
DefaultDependencies=no
Requires=systemd-reboot.service
After=systemd-reboot.service
AllowIsolate=yes
JobTimeoutSec=30min
JobTimeoutAction=reboot-force

[Install]
Alias=ctrl-alt-del.target
[root@Jenkins system]#
[root@Jenkins system]#
[root@Jenkins system]# systemctl status ctrl-alt-del.target
● reboot.target - Reboot
   Loaded: loaded (/usr/lib/systemd/system/reboot.target; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd.special(7)
[root@Jenkins system]# systemctl disable ctrl-alt-del.target
[root@Jenkins system]# systemctl mask ctrl-alt-del.target
Created symlink /etc/systemd/system/ctrl-alt-del.target → /dev/null.
[root@Jenkins system]#

刷新系统配置
systemctl daemon-reload


若想重新开启Ctrl+Alt+Del快捷键功能,只需要执行
systemctl mask ctrl-alt-del.target
命令,然后刷新配置即可。

已有 0 条评论

    欢迎您,新朋友,感谢参与互动!