SSHRC
If the file ~/.ssh/rc exists, sh(1) runs it after reading the environment files but before starting the user's shell or command. It must not produce
any output on stdout; stderr must be used instead. If X11 forwarding is in use, it will receive the "proto cookie" pair in its standard input (and
DISPLAY in its environment). The script must call xauth(1) because sshd will not run xauth automatically to add X11 cookies.
The primary purpose of this file is to run any initialization routines which may be needed before the user's home directory becomes accessible; AFS
is a particular example of such an environment.
This file will probably contain some initialization code followed by something similar to:
if read proto cookie && [ -n "$DISPLAY" ]; then
if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
# X11UseLocalhost=yes
echo add unix:`echo $DISPLAY |
cut -c11-` $proto $cookie
else
# X11UseLocalhost=no
echo add $DISPLAY $proto $cookie
fi | xauth -q -
fi
If this file does not exist, /etc/ssh/sshrc is run, and if that does not exist either, xauth is used to add the cookie.