Linux CENTOS7/RHEL7 off Ctrl+alt+delete function keys

Source: Internet
Author: User

This is my test pass, purely recorded to see, the final solution in the last, the middle is to meet some of the pits, you can skip the look!!

My operating experience, reproduced please indicate the source: http://www.cnblogs.com/huangjc/p/4536620.html

Linux defaults to allow anyone to restart the system by pressing Ctrl+alt+del . However, in a production environment, the ability to restart the system by pressing Ctrl-alt-del should be deactivated.

The Linux technology cows know that the previous CentOS version is configured in/etc/inittab , and Centos7/rhel7 view/etc/inittab file, it will tell you Ctrl+alt +del where this function key is set.

[Email protected] ~]#Cat/etc/Inittab # Inittab is no longer used if using systemd.## ADDING CONFIGURATION here would 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 is both main targets:## multi-user.target:analogous to RunLevel3# graphical.target:analogous to RunLevel5# to view current default target, run:# Systemctl get-default## to set a default target, run:# Systemctl set-default Target.target

Now we know that Ctrl+alt+del is configured in /usr/lib/systemd/system/ctrl-alt-del.target .

Then we direct vim to edit this file, in accordance with the previous setting to disable the function of the way to operate: all annotation points /usr/lib/systemd/system/ctrl-alt-del.target the contents of the file.

[Email protected]_rhel_b0109-~]# vim/usr/lib/systemd/system/ctrl-alt-del.target#[unit]# Description=reboot#documentation=man: systemd.special (7) # Defaultdependencies=no#requires=systemd-reboot.service#after=systemd-  Reboot.service#allowisolate=Yes#[install] #Alias=ctrl-alt-del.targe

Save exit, execute init q to re-reload configuration file.

Now start executing the Ctrl+alt+del three-key combination to see if this feature is OFF!!

Sure enough, the three keys do not take effect, seemingly successful, very happy to say!

However, ready to restart and try again,reboot down, waiting for a while, I do not move. Hang on, reboot command didn't take effect!

Hurry and see reboot.target this file:

[[Email protected]_rhel_b0109-Ten~]#Cat/usr/lib/systemd/system/reboot.target# Thisfileis part of systemd.## systemd is FreeSoftware; 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 version2.1of the License, or# (at your option) any later version.#[unit] #Description=reboot#documentation=Mans: Systemd.special (7) #DefaultDependencies=No#requires=systemd-Reboot.service#after=systemd-reboot.service#allowisolate=Yes#[install] #Alias=ctrl-alt-Del.target[[email protected]_rhel_b0109-Ten~]#

Well, it's all been written off! See if this is a soft link file.

[Email protected]_rhel_b0109-~]# ll/usr/lib/systemd/system/ctrl-alt-1  + at:/usr/lib/systemd/system/ctrl-alt-del.target -  reboot.target[[ Email protected]_rhel_b0109- ~]#

Sure enough to show Ctrl-alt-del.target This is reboot.target soft link.

After repeated testing, the correct method is:

Delete ctrl-alt-del.target this file.

Execute the init q re-reload configuration file again.

Don't think, it's done! That's it, that's it, okay ...

If you want to turn on this function, the method is ln-s to create a soft link back, and then reload the configuration file.

Linux CENTOS7/RHEL7 off Ctrl+alt+delete function keys

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.