2 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=koi8-r">
3 <TITLE>ðÒÁ×Á ÄÏÓÔÕÐÁ Ë X ÓÅÒ×ÅÒÕ</TITLE>
4 <META NAME="description" CONTENT="ëÁË ÄÏÂÉÔØÓÑ ÞÔÏÂÙ ÐÒÏÇÒÁÍÍÕ,
5 ÚÁÐÕÝÅÎÎÕÀ ÎÁ ÄÒÕÇÏÍ ÈÏÓÔÅ ÉÌÉ ÏÔ ÉÍÅÎÉ ÄÒÕÇÏÇÏ ÐÏÌØÚÏ×ÁÔÅÌÑ, ÐÕÓÔÉÌÉ
6 ÎÁÒÉÓÏ×ÁÔØ ÏËÏÛËÏ ÎÁ ×ÁÛÅÍ ÄÉÓÐÌÅÅ">
8 <H1>ðÒÁ×Á ÄÏÓÔÕÐÁ Ë X-ÓÅÒ×ÅÒÕ</h1>
10 Have you ever been troubled with X magic cookie authenification, trying
11 to start X-basing tool as root, when X display belongs to you, as
12 ordinary user? I have, and decide to write stupid shell script to get
13 around this problem. Note, that root can read your .Xauthority file.
14 So, if you want to su to another user, you'll need more elaborate solution.
16 Of course before you start to need this, you need to enable <B>xauth</B>
17 style authenification. If you are on that stage, read
18 <A HREF="http://r8h.cs.man.ac.uk:8000/tcl/secure.html">Quick quide</A>
20 <A HREF="http://r8h.cs.man.ac.uk:8000/"> Donal K. Fellows</A>.
23 There is several solutions
29 from xterm and then type password
30 Note that <B>xsu</B> doesn't support all options of <B>su</B>
34 # @(#) xsu - executes command as root in X11 with enabled autenification
35 # command should be passed as one argument
36 if [ -z "$DISPLAY" ]
38 echo "You are not running X11. Use plain su!"
41 if [ -z "$1" ]
45 command="$@"
47 su -c "xauth merge `eval echo ~$USER`/.Xauthority;$command"
49 <LI> add following code to your root <B>.bashrc</B> file,
50 and you would automatically recieve access to X server, when
51 you are typing <CODE>su</CODE> (but not <CODE>su -</CODE>)
53 # cut from root's .bashrc
55 if [ -n $DISPLAY ] && [ "$USER" != root ]
57 XAUTHORITY=`eval echo ~$USER`/.Xauthority
63 <LI>Add <b>wmsu</b> command
65 in your window manager menu, and you'll be presented by small window
66 to type password in before specified command would be run as root.
69 # @(#) xsu - executes command as root in X11 with enabled autenification
70 # command should be passed as one argument
71 if [ -z "$DISPLAY" ]
73 echo "You are not running X11. Use plain su!" >&2
76 if [ -z "$1" ]
78 echo "wmsu: no command supplied" >&2
83 xterm -geometry=20x2 -title "Type password" -e su -c "\"xauth merge `eval echo ~$USER`/.Xauthority;$command\""
88 If you often need to login to remote machines and start X programs from
89 there, you might want to use <A HREF="../software/unix/foreign_xterm.html">foreign_xterm</A>
90 script, which transfers correct authenification info to remote machine
91 and runs xterm or specified command from there via <B>rsh</B>.
93 to <B>rsh</B> and invoked command, so things like
95 foreign_xterm -l somebody somehost -e mc
97 would work. If called after name <tt>foreign_xapp</tt> it doesn't spawn xterm - just transfer authorization token and start desired command setting right value for DISPLAY variable.
99 Note, that if you use <A HREF="http://www.openssh.org">ssh</A>, you don't need
100 such tricks - it does them for you. But, if you are using some other daemons such as Network Audio or floppyd you might need it anyway