# Pkexec et AUTHENTICATING

**URL:** <https://www.debian-fr.org/t/pkexec-et-authenticating/91872>\
**Category:** Support Debian\
**Created:** [Décembre 19, 2025, 12:33 UTC](https://www.debian-fr.org/t/pkexec-et-authenticating/91872 "2025-12-19T00:33:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dindoun](https://www.debian-fr.org/user_avatar/www.debian-fr.org/dindoun/32/4281_2.png) [@dindoun](https://www.debian-fr.org/u/dindoun)\
**Post date:** [Décembre 19, 2025, 12:33 UTC](https://www.debian-fr.org/t/pkexec-et-authenticating/91872/1 "2025-12-19T00:33:26Z")

</div>

salut  
je me loggue sur une machine avec ssh -X [machin@192.168.0.2](mailto:machin@192.168.0.2)

quand je tape  
**pkexec /sbin/gparted**  
j’obtiens

```auto
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ====
Authentication is needed to run `/sbin/gparted' as the super user
Authenticating as: machin
Password: 
==== AUTHENTICATION COMPLETE ====

(gpartedbin:2418): Gtk-WARNING **: 01:14:32.642: cannot open display: 

```

mais quand je tape  
**pkexec /usr/sbin/gparted**

```auto
==== AUTHENTICATING FOR org.gnome.gparted ====
Authentication is required to run the GParted Partition Editor as root
Authenticating as: machin
Password: 
==== AUTHENTICATION COMPLETE ====

(gpartedbin:2745): dbind-WARNING **: 01:15:10.978: Couldn't connect to accessibility bus: Failed to connect to socket /run/user/1000/at-spi/bus_0: Aucun fichier ou dossier de ce nom
GParted 1.6.0
configuration --enable-libparted-dmraid --enable-online-resize
libparted 3.6

```

différence :

1. org.freedesktop.policykit.exec ====  
Authentication is needed to run `/sbin/gparted’ as the super user
2. org.gnome.gparted ====  
Authentication is required to run the GParted Partition Editor as root  
remarquez aussi le caractère spécial devant /sbin

Evidemment j’ai :  
`lrwxrwxrwx 1 root root 8 11 janv. 2025 sbin -> usr/sbin`

quelqu’un peut m’expliquer?

---

<div class="post-metadata">

**Author:** ![Clochette](https://www.debian-fr.org/user_avatar/www.debian-fr.org/clochette/32/8757_2.png) [@Clochette](https://www.debian-fr.org/u/Clochette)\
**Post date:** [Décembre 19, 2025, 2:07 UTC](https://www.debian-fr.org/t/pkexec-et-authenticating/91872/2 "2025-12-19T14:07:13Z")

</div>

Policykit ne résonne pâs en terme de chemin mais de binaire et de règles associé, c’est complexe à expliquer clairement mais de façon simple :

> [@dindoun](#):
>
> quand je tape  
> **pkexec /sbin/gparted**

Normale car pas de règle spécifiques dans policykit du coup tu passes par l’action par défaut et échoue, méthode à utiliser si pas tu n’as pas besoin de GUI et/ou que le chemin soit directement dans /sbin.

> [@dindoun](#):
>
> mais quand je tape  
> **pkexec /usr/sbin/gparted**

Tu passes cette fois-ci par une règle policykit disponible , méthode à privilégier lorsque tu souhaite utiliser une GUI et/ou que le binaire est dans /usr/sbin.

As-tu déjà testé d’appeler gparted directement sans pkexec, techniquement l’appel se fera correctement via /usr/sbin/gparted et aboutit correctement.

---

<div class="post-metadata">

**Author:** ![dindoun](https://www.debian-fr.org/user_avatar/www.debian-fr.org/dindoun/32/4281_2.png) [@dindoun](https://www.debian-fr.org/u/dindoun)\
**Post date:** [Décembre 19, 2025, 2:40 UTC](https://www.debian-fr.org/t/pkexec-et-authenticating/91872/3 "2025-12-19T14:40:08Z")

</div>

> [@Clochette](#):
>
> As-tu déjà testé d’appeler gparted directement sans pkexec, techniquement l’appel se fera correctement via /usr/sbin/gparted et aboutit correctement.

Oui ça ne marche pas,d’où l’essai par pkexec  
sudo /usr/sbin/gparted

```auto
[sudo] Mot de passe de machin : 
X11 connection rejected because of wrong authentication.

(gpartedbin:1659): Gtk-WARNING **: 15:39:43.972: cannot open display: localhost:10.0

```

su -  
Mot de passe :  
root@cccc:~# /usr/sbin/gparted

```auto
(gpartedbin:1932): Gtk-WARNING **: 15:41:12.772: cannot open display:

```

MAIS  
su -  
`# env DISPLAY=localhost:10.0 XAUTHORITY=/home/machin/.Xauthority /usr/sbin/gparted` fonctionne  
ET  
`$ sudo env DISPLAY=localhost:10.0 XAUTHORITY=/home/machin/.Xauthority /usr/sbin/gparted` fonctionne

`$ env DISPLAY=localhost:10.0 XAUTHORITY=/home/machin/.Xauthority sudo gparted` fonctionne

---

<div class="post-metadata">

**Author:** ![dindoun](https://www.debian-fr.org/user_avatar/www.debian-fr.org/dindoun/32/4281_2.png) [@dindoun](https://www.debian-fr.org/u/dindoun)\
**Post date:** [Décembre 19, 2025, 2:49 UTC](https://www.debian-fr.org/t/pkexec-et-authenticating/91872/4 "2025-12-19T14:49:32Z")

</div>

Conclusion :  
après s’être logguer par `ssh -X machin@OrdiDistant` , on lance la commande normale par exemple

`machin@ccc:~$ sudo gparted`

si ça ne marche, on doit voir `cannot open display: localhost:10.0`  
on rajoute alors `env DISPLAY=localhost:10.0 XAUTHORITY=/home/machin/.Xauthority` donc:

`machin@ccc:~$ env DISPLAY=localhost:10.0 XAUTHORITY=/home/machin/.Xauthority sudo gparted`

> **[Exécuter un programme root avec ssh/pkexec](https://dindoun.lautre.net/spip.php?article457)**
>
> L’idée est de se logguer sur un ordinateur distant et d’ouvrir un programme root/super utilisateuren ligne de commande. 
> 
> je ne comprends pas bien (…)

---

<div class="post-metadata">

**Author:** ![dindoun](https://www.debian-fr.org/user_avatar/www.debian-fr.org/dindoun/32/4281_2.png) [@dindoun](https://www.debian-fr.org/u/dindoun)\
**Post date:** [Décembre 19, 2025, 2:51 UTC](https://www.debian-fr.org/t/pkexec-et-authenticating/91872/5 "2025-12-19T14:51:19Z")

</div>

Merci clochette pour ton aide

Mais je ne comprends toujours pas pourquoi certaines commandes ont «&nbsp;leur policykit&nbsp;» et pas d’autres.  
Quel manuel proposerais-tu sur ce sujet?

---

<div class="post-metadata">

**Author:** ![Clochette](https://www.debian-fr.org/user_avatar/www.debian-fr.org/clochette/32/8757_2.png) [@Clochette](https://www.debian-fr.org/u/Clochette)\
**Post date:** [Décembre 19, 2025, 3:16 UTC](https://www.debian-fr.org/t/pkexec-et-authenticating/91872/6 "2025-12-19T15:16:48Z")

</div>

> [@dindoun](#):
>
> Quel manuel proposerais-tu sur ce sujet?

Mes maigres connaissances sur le sujet sont par essai empirique et ça [doc polkit](https://www.freedesktop.org/software/polkit/docs/latest/pkexec.1.html? __goaway_challenge=meta-refresh&__ goaway_id=9652bbff20051846886c9e08cde2e0d6&__goaway_referer=https%3A%2F%2Fwww.google.com%2F)😕
