Hi all,
How can I remove the "Shutdown ..." menu item from the Mate main menu, for all my users.
I do not want that any normal user is able to shutdown the machine, as it acts as a small server.
I also have a related question. On this machine, if a user open a terminal and enter:
$ halt
the system response is:
halt: Need to be root
So a normal user can not shutdown the system. That is sane.
But he can shutdown the system by clicking in "shutdown ..." mate main menu ... Strange no ?
Thanks for help,
Olivier
Customize mate menu
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Customize mate menu
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Customize mate menu
Well, you can right-click the menu button, go to preferences, go to the system tab, and disable quit. This will remove the quit button from the menu, but only for one user.
As a quick hack alternative, if you trust nobody, edit the file /usr/lib/linuxmint/mintMenu/plugins/system_management.py as root. Almost at the end of the file you will find this block of code:
all you need to do is replace that first line with a false statement (make sure the indentation remains the same, as that is how Python works). For example, change it to:
Now, no matter the personal preference of a user, their quit button won't be shown on their menu. After making the above change, either log out and in again to activate, or do "killall mintmenu".
Note that you can not easily stop a determined person from shutting down your system. You can also do that at the login screen. You can do it with the mate-session-save command shown in above. You can do it by sending a DBus message. You can do it with the Magic SysRq key. And so on, and so on all as a normal unprivileged user. So depends on your users how far you should take this...
As a quick hack alternative, if you trust nobody, edit the file /usr/lib/linuxmint/mintMenu/plugins/system_management.py as root. Almost at the end of the file you will find this block of code:
Code: Select all
if ( self.showQuit == True ):
Button7 = easyButton( "system-shutdown", self.iconsize, [_("Quit")], -1, -1 )
Button7.connect( "clicked", self.ButtonClicked, "mate-session-save --shutdown-dialog" )
Button7.show()
self.systemBtnHolder.pack_start( Button7, False, False )
self.mintMenuWin.setTooltip( Button7, _("Shutdown, restart, suspend or hibernate") )
Code: Select all
#if ( self.showQuit == True ):
if ( false ):
Button7 = easyButton( "system-shutdown", self.iconsize, [_("Quit")], -1, -1 )
Button7.connect( "clicked", self.ButtonClicked, "mate-session-save --shutdown-dialog" )
Button7.show()
self.systemBtnHolder.pack_start( Button7, False, False )
self.mintMenuWin.setTooltip( Button7, _("Shutdown, restart, suspend or hibernate") )
Note that you can not easily stop a determined person from shutting down your system. You can also do that at the login screen. You can do it with the mate-session-save command shown in above. You can do it by sending a DBus message. You can do it with the Magic SysRq key. And so on, and so on all as a normal unprivileged user. So depends on your users how far you should take this...
Re: Customize mate menu
Thanks for your reply ! I did not know that mate was based on python. Interesting !
For your info, I have install Mint two weeks ago after 10 years of Debian. Very nice distro. But in the last week a user (my wife!) shutdowns two times the system instead of logout !!!
And some people was working on the same machine via xdmcp ...
For your info, I have install Mint two weeks ago after 10 years of Debian. Very nice distro. But in the last week a user (my wife!) shutdowns two times the system instead of logout !!!
And some people was working on the same machine via xdmcp ...
Re: Customize mate menu
Well, MATE isn't based on Python--it's mostly C--but the mintMenu and other programs developed by the Linux Mint developers, like the Software Manager and Update Manager, are all written in Python. Makes it easy to apply these kind of hacks if needed