When installing a flatpak that will be installed globally anyone in the sudo
group can install a flatpak without sudo
.
Is there a way to either edit the polkit rules that are installed by flatpak to allow this or to just remove it altogether so that any time you try to install a global flatpak you will be prompted for a password using both the CLI and the Software Store (in my case KDE Discover)?
By default, flatpak polkit rules do not require a password. You can however set up rules to require one.
Ubuntu/Debian derivatives (
policykit
< 0.106)Create a new file named
flatpak‑sudo‑always‑password.pkla
in/etc/polkit‑1/localauthority/50‑local.d/
Any distro with
policykit
>= 0.106Create a new file named
01‑flatpak‑sudo‑always‑password.rules
in/etc/polkit‑1/rules.d/
These are direct reversions of the
policykit
rules whichflatpak
installs.The
org.freedesktop.Flatpak.modify-repo
permission was removed (enabled for all users by default),org.freedesktop.Flatpak.override-parental-controls
was removed (not applicable), and the returned policykit authorization type changed fromyes
back toauth_admin
. (polkit
manual on auth types)The
.rules
file was made by flatpak, and the.pkla
file by Debian, based on flatpak's.rules
file. Debian is not upgradingpolicykit
beyond0.105
for now, so they backported the.rules
to the old system.Original
.rules
file - - - Original.pkla
fileYou may want to consider using
auth_admin_keep
instead, if you don't want to be asked for your password for each flatpak and each runtime in one command.