Registered Member
|
I'm looking for a way to globally shut off the users being able to suspend/shutdown the machine in any way. The last piece I'm looking for is to remove the suspend options. The only way I've found to do it is to edit the /usr/bin/pm-is-supported as in this post https://forum.kde.org/viewtopic.php?f=67&t=30257
That was a few years ago now, and I'm wondering if there is a better way. maybe a setting in kdeglobals? or... if I disable acpi with a kernel parameter, the suspend to disk is still present. Thoughts? Thanks in advance. |
Registered Member
|
You can do this by dis-allowing suspend etc. with polkit. The way to do this depends on what version of polkit you have:
If you have polkit 0.105 (I think) or older, you can specify the policy in .pkla files - see e.g. https://wiki.archlinux.org/index.php/PolicyKit#Actions for details and https://wiki.archlinux.org/index.php/Po ... _hibernate for a suspend-related example (you'd want to put "no" instead of "yes" for each of ResultXXX) With newer polkit you would need to create Authorization Rules in .rules files: see http://www.freedesktop.org/software/pol ... kit.8.html for an overview. It's broadly similar, except you're writing javascript instead of a configuration file. |
Registered Member
|
ok, thanks for that!
I did play around with polkit before but the options were still in the menu (which I expected) but I made the configurations,rebooted, and selected menu/leave/suspend to ram --- it didn't prompt for root credentials and attempted to suspend the system.. (which causes it to go into a funk..). In any case, I don't want users to render the system unavailable as I want the processors available for grid processing. OS is Centos 6.4, KDE is 4.3 I followed this post http://blog.toracat.org/2011/09/removin ... nome-menu/ I put the following code into the /etc tree as indicated further down in the post. /etc/polkit-1/localauthority/50-local.d/10-disable-suspend-hibernate.pkla [code] [Disable suspend] Identity=unix-group:* Action=org.freedesktop.devicekit.power.suspend;org.freedesktop.devicekit.power.hibernate ResultAny=no ResultInactive=no ResultActive=no [/code] the man page talks about checking the actions in /usr/share/polkit/actions to make sure the actions are named correctly. which I think they are. I'll try putting it into the /var/lib tree to see if that makes a difference\ [edit] no effect with it in the var/lib tree. [/edit] Thoughts? |
Registered Member
|
Can't see any particular problem, though it's been a while since I've had experience of devicekit-power and the older versions of kde and polkit in CentOS. If you directly use devicekit-power to suspend/hibernate (e.g. using the dbus interfaces) does it still attempt to suspend? Note that you can do something like "echo freezer > /sys/power/pm_test" to have a less painful "hibernate" while you're testing this - see https://www.kernel.org/doc/Documentatio ... ugging.txt
Apart from that, I can only suggest trying centos support channels: they might have more idea of the subtleties of the devicekit-power and polkit versions found in centos. |
Registered Member
|
Thank you!
I think this does work for Gnome, and not KDE, that's why I wrote to the KDE forums. I will indeed check with the CentOS boards to see if anyone has any tips. I'm sure I'm missing something but I can't figure it out. Though my google-Fu is fairly strong... Thanks again for posting, I'll continue to search. Be well |
Administrator
|
I'm not sure if KDE interacted with PolicyKit in 4.3, or what sort of Power Manager was present in it.
The easiest way to make this entries disappear is to make KDE believe that Suspend to Disk and Suspend to RAM are not supported. As you are using KDE 4.3, this means you are probably using HAL - so if it does not advertise support for either, then KDE will not believe it is supported and will hide the entries.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
How odd. So Hal used to have a PolicyKit .policy so that you could have done this. But it seems that hal only talked PolicyKit and DeviceKit-power only talked polkit; so I don't think you can control hal policy in a DeviceKit-power/polkit world.
So editing /usr/bin/pm-is-supported is probably still the best way to disable kde suspend in Centos 6. Maybe you can do something with hal .fdi files, but it probably isn't worth the effort. So the answer to your question from the original post is that there is a better way to disable suspend, but not in stock CentOS 6. It looks like Centos 6 is effectively "a few years ago now", for these purposes. |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]