[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sudo in X-environment



On Thu, May 1, 2014 at 4:51 AM, Johann Spies <johann.spies@gmail.com> wrote:
>
> For years I have used sudo both in server administration and on the desktop.
>
> Lately I get the following error message and I do not really know what to do
> about it other than logging into the xserver as root - which I do not want
> to do:
>
> $ sudo system-config-printer
>
> No protocol specified
> error: XDG_RUNTIME_DIR not set in the environment.
> Unable to init server: Could not connect: Connection refused
> No protocol specified
>
> ** (system-config-printer.py:5632): WARNING **: Could not open X display
> No protocol specified
> error: XDG_RUNTIME_DIR not set in the environment.
> Unable to init server: Could not connect: Connection refused
> No protocol specified
> error: XDG_RUNTIME_DIR not set in the environment.
> Unable to init server: Could not connect: Connection refused
>
> Why is it now a problem while previously I had no hassles?

You could try to "env_keep" XDG_RUNTIME_DIR?

I'm not sure that the above is appropriate. It might be better to
create, for example, "/root/xdg_run/" or "/run/user/0/" and then do
'sudo "XDG_RUNTIME_DIR=<...> system-config-printer"'.

Have you tried gksu/gksudo or kdesudo (or pkexec) for GUI apps? They
might still do the right thing since they're meant for GUI apps.


Reply to: