Loading... <div class="tip share">请注意,本文编写于 1630 天前,最后修改于 1609 天前,其中某些信息可能已经过时。</div> 查看`/etc/inittab`中的设置 ``` [root@dns-a ~]# cat /etc/inittab # inittab is no longer used when using systemd. # # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target # # systemd uses 'targets' instead of runlevels. By default, there are two main targets: # # multi-user.target: analogous to runlevel 3 # graphical.target: analogous to runlevel 5 # # To view current default target, run: # systemctl get-default # # To set a default target, run: # systemctl set-default TARGET.target # ``` 根据`/etc/inittab`中的提示,ctrl+alt+del关机的配置是在`/usr/lib/systemd/system/ctrl-alt-del.target`中,查看此文件内容如下: ``` [root@dns-a ~]# cat /usr/lib/systemd/system/ctrl-alt-del.target # 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 ``` 查看`/usr/lib/systemd/system/ctrl-alt-del.target`,其实是`reboot.target`文件的软链接 ``` [root@dns-b ~]# ll /usr/lib/systemd/system/ctrl-alt-del.target lrwxrwxrwx. 1 root root 13 Jul 9 22:27 /usr/lib/systemd/system/ctrl-alt-del.target -> reboot.target ``` 因此,要想禁用ctrl+alt+del重启系统,只需要删除此软链接即可 最后修改:2020 年 07 月 31 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏