Re: Using setenv DISPLAY
On Mon, Mar 06, 2006 at 08:08:35AM -0500, Haines Brown wrote:
>
> $ env | grep DISPLAY.
> DISPLAY=:0.0
>
> $ sudo env | grep DISPLAY
> [nothing returned]
>
> Why do I get inconsistent results?
As others have pointed out, sudo does not by default preserve its
environment when starting privileged processes. To get X working, you
will want to have sudoers retain both DISPLAY and XAUTHORITY.
> # sudo setenv DISPLAY teufel:0
>
> but I get the error, "command not found". Shouldn't it be accessible
> from a bash prompt when using sudo?
setenv is not an external command such as can be launched by sudo, but
a csh builtin. export is a bourne shell builtin; it will not work like
this either. To use shell builtins to export, you must do something
like this:
sudo sh -c "DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY xterm"
Reply to: