4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Running pkexec on environments without GUI (and with X transfer)

Posted at

If you try to run pkexec on SSH, you might get the following error even if the host machine has GUI session:

==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/bin/apt-get' as the super user
Authenticating as: root
Password: 
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===

This means host machine GUI session's policykit agent cannot be launched on SSH. So we need to have a standalone agent.

sudo apt-get -y install policykit-1-gnome # only first time
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &
4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?