[OpenAFS] significant delay for afs user to login as root via su

Carson Gaspar carson@taltos.org
Thu, 18 Mar 2010 12:42:34 -0700


ematlis@yahoo.com wrote:
> That doesn't seem to be working either.  Maybe there is something
> else going on?  Notice the "X11 connection rejected" error:

So I actually did some testing. Environment variables set in .ssh/rc are 
ignored by your login shell. So you either need to set XAUTHORITY in 
.ssh/environment and set PermitUserEnvironment to yes in sshd_config, or 
you need to set it in your shell login scripts (.bash_profile or 
whatever). Note that you can't use $USER in .ssh/environment.

carson:gandalf 0 $ cat .ssh/environment
XAUTHORITY=/tmp/.carson/.Xauthority

carson:gandalf 0 $ cat .ssh/rc
test -z "$DISPLAY" && exit 0

unset XAUTHORITY
if test ! -d "/tmp/.${USER}"; then
     (umask 77; mkdir "/tmp/.${USER}") && \
     XAUTHORITY="/tmp/.${USER}/.Xauthority"
else
     touch "/tmp/.${USER}/.Xauthority" && \
     XAUTHORITY="/tmp/.${USER}/.Xauthority"
fi
if test -z "${XAUTHORITY}"; then
     # Something is wrong
     test -t 2 && echo "Could not set XAUTHORITY" 1>&2
     exit 0
else
     export XAUTHORITY
fi

if read proto cookie; then
     if test "${DISPLAY%%:*}" = 'localhost'; then
         # X11UseLocalhost=yes
         echo add unix:${DISPLAY#*:} $proto $cookie
     else
         # X11UseLocalhost=no
         echo add $DISPLAY $proto $cookie
     fi | /usr/X11/bin/xauth -q - 1>&2
fi