Re: [gtk-list] gtk or Xhost problem with linuxconf
- From: Karl Nelson <kenelson ece ucdavis edu>
- To: gtk-list redhat com
- cc: kenelson elm ece ucdavis edu
- Subject: Re: [gtk-list] gtk or Xhost problem with linuxconf
- Date: Wed, 29 Mar 2000 10:23:11 -0800
You might want to make a simple script which copies around your
X auth keys with su. Here is one that I use for my support job.
(It has a lot of bugs, but would be a start.) Mine is a tcsh
only shop, so we didn't need to worry about not having csh
commands work after the su. Obviously this would have to change
depending on what shell the su goes to.
--Karl
----------------------------------------------------------------
#!/bin/sh
#
# Script to change user while keeping Xdisplay.
#
# Feb 1 2000 created Karl E Nelson
#
if test $# -gt 2 || test $# -eq 2 && test "$1" != "-" ; then
echo "usage: xsu [-] [username]"
exit
fi
USER="root"
CD="cd "`pwd`";"
while test $# != "0" ; do
if test $1 = "-" ; then CD="" ; else USER=$1; fi
shift
done
XA=/usr/bin/X11/xauth
if test "X$DISPLAY" != "X" ; then
XAUTH=`xauth list $DISPLAY`
LOCAL_HOST=`hostname | awk -F . '{print $1}'`
DISPLAY_HOST=`echo $DISPLAY | awk -F : '{print $1}'`
echo "Transfering key for $DISPLAY"
XCOMMAND="setenv DISPLAY $DISPLAY ; xauth add $XAUTH ; setenv TERM $TERM"
if test "X$LOCAL_HOST" = "X$DISPLAY_HOST" ; then
XAUTH_LOCAL=`xauth list unix:0`
su - $USER -c "($XCOMMAND; $XA add $XAUTH_LOCAL; $CD tcsh)"
else
su - $USER -c "($XCOMMAND; $CD tcsh)"
fi
else
echo "No display to set"
su - $USER -c "($CD tcsh)"
fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]