Re: SUMMARY: xhost problem when using emacs as su

From: Per Hedeland (per@erix.ericsson.se)
Date: Sun Aug 09 1992 - 20:33:23 CDT


In article <1992Aug3.205717.7235@colorado.edu> ejh@khonshu.colorado.edu (Edward J. Hartnett) writes:
>Several others suggested that I setenv XAUTHORITY in my /.cshrc to
>point to my home directory's .Xauthority file. This is what I have done.
>Thanks to Andreas Luik, Sami-Jaakko Tikka, waldvoge@nessie.cs.id.ethz.ch,
>and Casper Dik.

I realize that this is a bit late, but I cant resist sharing my 'su'
alias to handle this in a somewhat general fashion, including the case
of NFS-mounted and 'nobody'-unreadable home directory that Casper
mentioned ('super' is the name of my NFS server):

# make sure authority file is readable when we su
if ($?DISPLAY) then
        if ($HOST =~ super*) then
                if (! $?XAUTHORITY) then
                        alias su '/bin/sh -c '"'"'XAUTHORITY=${XAUTHORITY-$HOME/.Xauthority}; export XAUTHORITY; exec /bin/su \!*'"'"
                endif
        else
                alias su '/bin/sh -c '"'"'cp ${XAUTHORITY-$HOME/.Xauthority} /tmp/.Xauthority.$USER; XAUTHORITY=/tmp/.Xauthority.$USER; export XAUTHORITY; exec /bin/su \!*'"'"
        endif
endif

I guess I should have folded the lines, but it's such a pain in csh...

--Per Hedeland
per@erix.ericsson.se or
per%erix.ericsson.se@sunic.sunet.se or
...uunet!erix.ericsson.se!per



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:46 CDT