pkexec command not found

In this troubleshooting guide we learn how to fix pkexec command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

pkexec: command not found

or when using sudo you get the following error message

sudo: pkexec: command not found

Solutions to pkexec: command not found

How To Fix pkexec: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu pkexec is provided by pkexec package.

pkexec is:

polkit is an application-level toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes. It was previously named PolicyKit.

pkexec is a setuid program to allow certain users to run commands as root or as a different user, similar to sudo. Unlike sudo, it carries out authentication and authorization by sending a request to polkit, so it uses desktop environments’ familiar prompting mechanisms for authentication and uses polkit policies for authorization decisions.

By default, members of the ‘sudo’ Unix group can use pkexec to run any command after authenticating. The authorization rules can be changed by the local system administrator.

If this functionality is not required, removing the pkexec package will reduce security risk by removing a setuid program.

To fix this problem, we can install more using the command below.

sudo apt-get -y install pkexec

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install pkexec.

sudo apt -y install pkexec

Or if you have aptitude installed you can use the following command.

sudo aptitude install pkexec

Summary

In this tutorial we learn how to fix pkexec command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.