How to remove Restart/ Shutdown/Suspend Hibernate button- applet from the user's menu.
When I goto logout, I see these other buttons users can run. I want to make sure they cannot restart/shutdown/suspend/hibernate the system.
if you remove that user from power group... he/she wont be able to suspend/hibernate .. not sure how to remove restart and shutdown... try removing the user from the wheel group maybe that might work.
I suppose it depends on what toolkit is handling the priviledges. For example, I'm using PolicyKit. To disable suspend, hibernate, restart and powering off, I edited the files in
for reboot and powering off and
for suspend and hbernate.
Changing the permissions from
<allow_any>yes</allow_any> <allow_inactive>yes</allow_inactive> <allow_active>yes</allow_active>
<allow_any>no</allow_any> <allow_inactive>no</allow_inactive> <allow_active>no</allow_active>
under the relevant field totally disables the function to suspend, hibernate etc... but changing it to
<allow_any>auth_admin_keep</allow_any> <allow_inactive>auth_admin_keep</allow_inactive> <allow_active>auth_admin_keep</allow_active>
Will prompt the user for admin password when the options are selected.
Additional rules may be defined in the rules.d folder under /usr/share/polkit-1 or /etc/polkit-1 though, so those may affect the behaviour as well.
I apologize in advanced if the information may not be useful depending on your system setup. I'm running Arch Linux and referring heavily to https://wiki.archlinux.org/index.php/PolicyKit
Edit: Code tags
Last edited by YJLee (2012-11-20 02:07:00)
Thanks for the feedback. I was looking for how to only display the logout button instead of showing the restart/hibernate/shutdown/suspend.
So far I'm able to restart the workstation.(I read that use would need SUDO rights.)
I'm not using any type of policykit that I know of. Running on Redhat 5.8
The program 'xfce-session-logout' displays the normal logout box, so options include modifying the source to this package and recompiling it for your system, or replacing the actual xfce-session-logout with a script that sends the real binary the '-l' parameter which tells xfce-session-logout to logout without displaying any prompt.
That solution is the most hacky (And not recommended, you'll have to keep in mind that if an update happens that updates the xfce4-session-logout binary, this change will be reverted) but it should cover all cases for logging out the normal way in Xfce. This will make it basically impossible to suspend/reboot/shutdown from XFCE though, you'd have to do it through other means such as a terminal.
It should be noted, while these will prevent someone from doing it via the Xfce menu, there isn't much to prevent a user from doing so via terminal or something similar (Or calling the command directly via the terminal). Editing polkit to not allow normal users to poweroff the system is really the best option, but with the new changes to polkit >107 it may be a bit annoying to do.
Hope that helps,
This removes any capability to access a logout/shutdown/restart/sleep option. This may work:
1. Right click on the application menu in your panel. On my setup it's either an Ubuntu symbol or a Mouse.
2. Click Properties
3. Right here you could use a custom menu under Use custom menu file but for now click Edit Menu.
4. Collapse every item in the tree on the left of the window. There should be only one left. In my case it is UbuntuStudio.
5. The right pain at the bottom should have a checkmark for "Log Out". Uncheck it.
Next, we're going to add an ability to log out:
1. Right click on the panel that you want a logout button to be placed.
2. Click Add New Items
3. Click on Action Buttons.
4. Click Add.
5. Click Close.
6. Right click on the Action Button that was just added. For me it is my current login.
7. Click Properties.
8. Under Appearance drop-down-box select Action Buttons.
9. Uncheck what you don't want to be displayed.
10. And also uncheck the "Log Out...". It's the one with dot dot dot. This disables the log out Menu.
11. Check the one "Log Out"
12. Click Close.
Now we're going to remove the Application Menu:
1. Right click on the Application Menu in the panel and select Remove.
Hopefully I didn't leave any steps out, but this is the basic idea.