xhost problem when using emacs as su

2007-12-25 7:50:00

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

Comments

Got something to say?

You must be logged in to post a comment.