Thursday, March 18, 2021

Reboot gaurd

There is shutdown restricted for the below users in /etc/shutdown.allow file in CentOS6 & 7 servers.
 

[root@Babbage ANALYSIS4]# cat /etc/shutdown.allow
prasanna.paul
 

There is reboot and shutdown guard configured in all CentOS 7 servers as a part of security measure.
The below two files have to be created for reboot or shutdown guard in CentOS7. This will help us to avoid accidental reboots or shutdowns through
commands.
 

vi /etc/systemd/system/reboot-guard.service
[Unit]
Description=Reboot Guard
[Service]
ExecStart=/bin/true
[Install]
RequiredBy=shutdown.target
 

vi /etc/systemd/system/start-reboot-guard.service
[Unit]
Description=Start Reboot Guard
[Service]ExecStart=/bin/systemctl enable reboot-guard
[Install]
WantedBy=multi-user.target
The below commands used to enable the reboot guard in the OS.
systemctl daemon-reload
systemctl enable reboot-guard start-reboot-guard
 

To disable the reboot/shutdown-guard provide the below command.
systemctl disable reboot-guard

0 Comments: