Re: SUMMARY: xhost problem when using emacs as su

From: Per Hedeland (
Date: Sun Aug 09 1992 - 20:33:23 CDT

In article <> (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,,
>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 \!*'"'"
                alias su '/bin/sh -c '"'"'cp ${XAUTHORITY-$HOME/.Xauthority} /tmp/.Xauthority.$USER; XAUTHORITY=/tmp/.Xauthority.$USER; export XAUTHORITY; exec /bin/su \!*'"'"

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

--Per Hedeland or or

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