Sample Header Ad - 728x90

Cross-platform way to determine if the current user has privlige to shutdown the machine (without actually attempting shutdown)

0 votes
1 answer
51 views
How can I check (in a safe way) if the current user has the permissions needed to shutdown the system on Unix & Linux? I'm writing a script that needs to check to see if the current user has the permission needed to shutdown the system. But, of course, I want to determine this *before* actually attempting to shutdown the system. Ideally, I'd like a solution that works on as many Unix & Linux distros as possible. What can I execute in my script to check to see if the current user has permission to shutdown the system?
Asked by Michael Altfield (382 rep)
Oct 2, 2022, 02:19 AM
Last activity: Oct 3, 2022, 09:30 AM