Mailinglist Archive: opensuse (4631 mails)
| < Previous | Next > |
Re: [opensuse] Getting error "cannot connect to X server" when using sudo to run a program
- From: "Andy Harrison" <aharrison@xxxxxxxxx>
- Date: Thu, 18 Jan 2007 21:46:09 -0500
- Message-id: <a22ff2940701181846g49de5488wc075d8e988fafbf5@xxxxxxxxxxxxxx>
On 1/18/07, Graham Smith <gqs@xxxxxxxxxxxxx> wrote:
I tried it myself and I get the exact same results. I've never seen
sudo misbehave this way and I use every day (though only Solaris and
FreeBSD) including for remotely displaying X apps like veritas
netbackup. Normally the environment variables are not completely
wiped out, but this is not the case here.
The DISPLAY variable is clearly getting flushed. The ONLY way I could
get it to work on my 10.2 system was:
if [ -z "$DISPLAY" ] ; then
export DISPLAY=":0.0"
fi
xcalc
And up pops xcalc.
Obviously this method would fail if you wanted to tunnel the display
through ssh.
Just to make sure I'm not dreaming I tried it and here it is working
successfully on Solaris.
> printenv PWD
/tmp
DISPLAY is not getting squashed.
--
Andy Harrison
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
xauth info on both systems are the same.
The output of xhost is the same.
I tried it myself and I get the exact same results. I've never seen
sudo misbehave this way and I use every day (though only Solaris and
FreeBSD) including for remotely displaying X apps like veritas
netbackup. Normally the environment variables are not completely
wiped out, but this is not the case here.
printenv HOME/home/aharrison
printenv DISPLAY:0.0
sudo printenv HOME/root
sudo printenv DISPLAY
The DISPLAY variable is clearly getting flushed. The ONLY way I could
get it to work on my 10.2 system was:
cat /tmp/test.sh#!/usr/bin/sh
if [ -z "$DISPLAY" ] ; then
export DISPLAY=":0.0"
fi
xcalc
sudo /tmp/test.sh
And up pops xcalc.
Obviously this method would fail if you wanted to tunnel the display
through ssh.
Just to make sure I'm not dreaming I tried it and here it is working
successfully on Solaris.
> printenv PWD
/tmp
printenv DISPLAYlocalhost:10.0
sudo printenv PWD/tmp
sudo printenv DISPLAYlocalhost:10.0
DISPLAY is not getting squashed.
--
Andy Harrison
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |