You are not logged in.

#1 2021-11-28 09:03:40

sakya
Member
Registered: 2021-09-26
Posts: 9

[SOLVED] Cannot change gedit options as root

If I run gedit as root with

sudo gedit

I'm unable to change settings (like the color profile).
In the terminal I get the error

failed to commit changes to dconf: Error spawning command line “dbus-launch --autolaunch=3f67c676947b4093a67081e66ce01682 --binary-syntax --close-stderr”: Child process exited with code 1

Last edited by sakya (2021-11-28 10:52:23)

Offline

#2 2021-11-28 09:11:53

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Cannot change gedit options as root

That's because you shouldn't be using sudo to run GUI applications in the first place.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2021-11-28 09:32:03

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Cannot change gedit options as root

To edit files as root use the GVFS admin:// backend:

gedit admin:///full/path/to/file

EDIT: or

SUDO_EDITOR=gedit sudoedit /full/path/to/file

Set the SUDO_EDITOR variable globally if you always want to use gedit.

EDIT2: and for bonus points here's a root-editor.desktop file to allow use from a menu or file manager:

[Desktop Entry]
Name=Sudoeditor
Comment=Edit text files as root
Exec=rootedit %U
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
Icon=org.gnome.gedit
Categories=GNOME;GTK;Utility;TextEditor;

^ Place that file in /usr/local/share/applications/ (for system-wide use) or ~/.local/share/applications (for just your user).

And this is the rootedit script:

#!/bin/sh
SUDO_EDITOR=gedit sudoedit "$@"

^ Make that executable and place it under /usr/local/bin/ (or in ~/bin/).

Once they are in place select "Sudoeditor" as the application from the file manager wink

Last edited by Head_on_a_Stick (2021-11-28 10:45:57)

Offline

#4 2021-11-28 10:51:35

sakya
Member
Registered: 2021-09-26
Posts: 9

Re: [SOLVED] Cannot change gedit options as root

Head_on_a_Stick wrote:

To edit files as root use the GVFS admin:// backend:

gedit admin:///full/path/to/file

Many thanks, easy solution wink

Offline

Board footer

Powered by FluxBB