Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I prevent access to shutdown but not reboot?

I have a ubuntu pc running as a plex server. How do I get it so that no one can shutdown the computer but only allow the user to reboot the machine? I know it is possible in windows but I am just wondering if it is possible on ubuntu.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The most effective way to do this would be to mask the power off target like this:

sudo systemctl mask poweroff.target

Now it will be impossible for anyone to shut down the machine unless they hold down the power button or physically disconnect the machine from power.

Rebooting is unaffected by this mask.


In the event you need to shut the machine down in the future for maintenance or hardware replacement, you can unmask the target:

sudo systemctl unmask poweroff.target
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading