Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
27
rated 0 times [  27] [ 0]  / answers: 1 / hits: 3032  / 3 Years ago, sat, october 23, 2021, 9:40:20

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.


More From » networking

 Answers
4

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

[#882] Saturday, October 23, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
laceanz

Total Points: 86
Total Questions: 113
Total Answers: 104

Location: Australia
Member since Thu, Jan 26, 2023
1 Year ago
laceanz questions
Tue, Apr 26, 22, 07:43, 2 Years ago
Sat, Nov 5, 22, 08:24, 2 Years ago
Sat, Mar 12, 22, 07:56, 2 Years ago
Tue, Mar 28, 23, 23:58, 1 Year ago
;