Re: How do you use su under X?
Helge Hafting <helge.hafting@daldata.no> writes:
> I want the cookie security so other users can't do anything wrong.
> I also want "root" to be able to use the X display no matter
> who is running x. What is the simplest way to
> achieve this?
At the command line in the user's session, type:
su -c "xauth add $(xauth list $DISPLAY); xterm &"
This will prompt you for the root password, and then open an xterm running as
root in the background. You will also be able to start other X clients from
that xterm window. (Be sure to use double quotes. Single quotes will expand
the $(xauth list $DISPLAY) as root, not as the current user.)
If you want to be fancy, you could make this a shell script, and put it in,
say, /usr/local/bin/xsu:
#!/bin/bash
su $1 -c "xauth add $(xauth list $DISPLAY); xterm &"
Then you would just type `xsu' to start an xterm as root, or `xsu joeuser' to
start an xterm as joeuser.
--
David Zelinsky
dsz@alumni.caltech.edu
Reply to: