gksu is dead long live pkexec

I don’t use it very often but occasionally it can be useful to have a launcher somewhere on my desktop that starts a terminal session as root.

Older distributions used  gksu  to prompt the user for a password and allow them to launch an application at root, but when installing the Mate Desktop on my Jetson Nano this weekend I discovered that  gksu  has now been deprecated in both Debian and Ubuntu and replaced by  pkexec .

The solution seems simple enough, just install  pkexec  and modify the launcher to use  pkexec  instead of  gksu 

The only problem was that this didn’t work, so it was time to read the manual! After a bit of searching I found the documentation, and discovered that in addition to modifying the launcher you also need to login as root and create a new policy file.

Fortunately it isn’t too hard to modify the example.

nano /usr/share/polkit-1/actions/org.mate.mate-terminal.policy

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
  <vendor>MATE Desktop</vendor>
<action id="org.mate-terminal.pkexec">
  <description>Run mate-terminal as root</description>
  <message>Authentication is required to run mate-terminal as root.</message>
  <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/mate-terminal</annotate>
  <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>

The changes should take effect immediatly.

This entry was posted in Debian, Linux, Raspbian, Ubuntu and tagged . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.