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 :
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