You are not logged in.

#1 2023-11-07 19:23:39

lkop7617
Member
Registered: 2023-11-07
Posts: 2

export Display

#gparted
Authorization required, but no authorization protocol specified


(gpartedbin:7357): Gtk-WARNING **: 00:21:52.583: cannot open display: :1

----------------------------------------------------------------------------------------
#neofetch
                   -`                    root@archlinux
                  .o+`                   --------------
                 `ooo/                   OS: Arch Linux x86_64
                `+oooo:                  Host: 82KD Lenovo V15 G2 ALC
               `+oooooo:                 Kernel: 6.5.9-arch2-1
               -+oooooo+:                Uptime: 6 mins
             `/:-:++oooo+:               Packages: 1164 (pacman)
            `/++++/+++++++:              Shell: bash 5.2.15
           `/++++++++++++++:             DE: Hyprland
          `/+++ooooooooooooo/`           Theme: Adwaita [GTK2/3]
         ./ooosssso++osssssso+`          Icons: Adwaita [GTK2/3]
        .oossssso-````/ossssss+`         Terminal: kitty
       -osssssso.      :ssssssso.        CPU: AMD Ryzen 5 5500U with Radeon G
      :osssssss/        osssso+++.       GPU: AMD ATI 04:00.0 Lucienne
     /ossssssss/        +ssssooo/-       Memory: 1592MiB / 9808MiB
   `/ossssso+/:-        -:/+osssso+-
  `+sso+:-`                 `.-/+oso:                           
`++:.                           `-/+/                           
.`                                 `/

Offline

#2 2023-11-07 20:03:23

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Offline

#3 2023-11-07 20:41:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,630

Re: export Display

Short version: Don't.
Install and run an https://wiki.archlinux.org/title/Polkit … ion_agents - gparted will then leverage itself.

Also please use [code][/code] tags. Edit your post in this regard.

Online

#4 2023-11-08 16:45:31

lkop7617
Member
Registered: 2023-11-07
Posts: 2

Re: export Display

sudo -E program

Offline

#5 2023-11-08 19:40:07

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,630

Re: export Display

That preserves the entire environment, poses a significant security risk and you might end up re-owning critical files in your $HOME to UID0
Your sudoers should™ typically not even allow for that.

Again: Do. Not. Do. That. At. All.
gparted specifically has self-elevation capabilites, use those.

Online

#6 2023-11-08 20:10:08

tekstryder
Member
Registered: 2013-02-14
Posts: 582

Re: export Display

seth wrote:

gparted specifically has self-elevation capabilites, use those.

Hi Seth. Could you expand on that please? I'm not aware of a safe way to launch gparted in a pure wayland environment (no Xwayland).

EDIT:

This is the typical polkit launch:

Nov 08 15:05:48 polkitd[833]: Operator of unix-session:7 successfully authenticated as unix-user:myusername to gain ONE-SHOT authorization for action org.gnome.gparted for unix-process:324985:33171459 [/bin/sh /usr/bin/gparted] (owned by unix-user:myusername)
Nov 08 15:05:48 pkexec[324991]: pam_unix(polkit-1:session): session opened for user root(uid=0) by myusername(uid=1000)
Nov 08 15:05:48 pkexec[324991]: myusername: Executing command [USER=root] [TTY=unknown] [CWD=/home/myusername] [COMMAND=/usr/bin/gparted]
Nov 08 15:05:48 systemd[1]: Reloading requested from client PID 325016 ('systemctl') (unit user@1000.service)...
Nov 08 15:05:48 systemd[1]: Reloading...
Nov 08 15:05:48 systemd[1]: Reloading finished in 198 ms.
Nov 08 15:05:48 gpartedbin[325132]: cannot open display: 
Nov 08 15:05:48 systemd[1]: Reloading requested from client PID 325134 ('systemctl') (unit user@1000.service)...
Nov 08 15:05:48 systemd[1]: Reloading...
Nov 08 15:05:48 systemd[1]: Reloading finished in 196 ms.

Last edited by tekstryder (2023-11-08 20:34:36)

Offline

#7 2023-11-08 20:36:35

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,630

Re: export Display

gparted uses polkit, if you've an agent running the agent should™ ask you for creds and allow gparted to run but that seems to only work on xwayland (and from the OP it's not clear that xwayland isn't available)

In that case either approach is (for now) equally bad because gparted runs the GUI as root nevertheless until https://gitlab.gnome.org/GNOME/gparted/-/issues/26 is fixed sad

"sudo -E" is just generally a terrible pattern, as is running GUI stuff as root.
"sudo -EH" will at least not taint your $HOME and in an ideal shouldland world you'd use a sudoers rule to preserve the minimally required environment ($WAYLAND_DISPLAY ?, you can test this w/ --preserve-env) and nothing else (eg. $PATH !)

Online

#8 2023-11-08 21:43:14

tekstryder
Member
Registered: 2013-02-14
Posts: 582

Re: export Display

Cool. We're on the same page with all of that. Was secretly hoping you had some magical Wayland root gui elixir up your sleeve.

Only gparted and gsmartcontrol where I've needed to resort to such methods (sudo -EH) since switching away from X11, and those only employed during quarterly backups. No issues here.

Offline

Board footer

Powered by FluxBB