Re: how to run X apps as root?
On Tue, 3 Jul 2001, Arne Goetje wrote:
> sometimes I need to run some X apps as root (i.e. ethereal, lprngtool) but
> Xlib complains that the server refuses the connection.
> how can I make the Xserver accept programs as root when I'm working as
> normal user?
That because Debian recently changed to disable xhost, and now
restricts access on a per user basis (kind of). That's a good move
because xhost was pretty insecure. Now to access X you must show that
you know a secret 128bit or something number that is generated when the
X session starts. So in order for root to be able to access the X
server, you must give him this secret value using xauth.
But that a pain to do each time you do an su. So I wrote an su
wrapper which transfer $DISPLAY and also transfers the X cookies that
you must have to gain access to the X server. I called is sux and you
can get it from http://fgouget.free.fr/sux/
You use it just like su:
$ sux -
$ sux - foo
$ sux --untrusted --timeout 30 - foo xterm
-> created an untrusted cookie that becomes invalid after 30 seconds of
inactivity, typically 30 seconds after you've closed the xterm.
> 2nd Problem: I tried today to run a second instance of startx with -- :1 to
> run it as root. today it didn't work anymore... I'm using unstable.
Maybe that because the vt is missing:
$ startx -- vt8 :1
or maybe it is
$ startx -- :1 vt8
Francois Gouget email@example.com http://fgouget.free.fr/
Before you criticize someone, walk a mile in his shoes.
That way, if he gets angry, he'll be a mile away - and barefoot.