[Tfug] can't start opera after su to other user

John Gruenenfelder johng at as.arizona.edu
Thu Jan 24 21:02:29 MST 2008


On Thu, Jan 24, 2008 at 08:07:11PM -0700, christ wrote:
>Hey, I was su'd to another user on my system, and
>noticed that I couldn't start firefox or opera like
>I can when I su to root.
>
>The message is 
>%firefox
>Xlib: connection to ":0.0" refused by server
>Xlib: No protocol specified
>(firefox-bin:70552): Gtk-WARNING **: cannot open display: :0.0
>
>Does anyone know why I can do this under root, but
>not other users? Just curious.
>
>BTW, I'm on freebsd if it matters ~ Chris

This occurs because of X authentication.  In your home directory you should
see a .Xauthority file.  This controls who can display on the currently opened
X display.  When you 'su' to another user, you no longer have this file and X
won't display for security reasons.  In the before times, X had pretty bad
security and other people could cause windows to appear on your screen even
though you hadn't launched them, and this prevents that.

There are a few ways around this:

1) ssh to the root account.  Normally, ssh will forward X connections, so if
you 'ssh root at localhost' and then run any X program, you should get the
desired result.

2) Copy /home/USER/.Xauthority to /root and then root will have permission to
fiddle with the running X display.

3) As a last resort, as the original user you can run 'xhost +' to allow any X
connection and that should work.  Really, you should use SSH because this
method will allow anybody to draw on your current X display.  Unless you're on
a private subnet with no port forwarding, this is very bad.

SSH is the best and easiest method to use.  Use xhost only if nothing else
works.  The only advantage to using the xhost method is that the speed is
better because you don't have to route through the SSH encryption layer.  But,
I don't see how running Opera as root will help you.  If anything, it will
write to /root/.opera and not to some global location.


-- 
--John Gruenenfelder    Research Assistant, UMass Amherst student
                        Systems Manager, MKS Imaging Technology, LLC.
Try Weasel Reader for PalmOS  --  http://gutenpalm.sf.net
"This is the most fun I've had without being drenched in the blood
of my enemies!"
        --Sam of Sam & Max




More information about the tfug mailing list