Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Alternate method for ssh X11 forwarding and .bashrc handling' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Alternate method for ssh X11 forwarding and .bashrc handling
Authored by: finitesquid on Sep 27, '05 01:20:33PM
If it helps any, here's what I do for my X11 forwarding for ssh for bash.

Note that I have X11.app Security preferences set to both "Authenticate connections" and "Allow connections from network clients". Also, I have ssh_config read "ForwardX11 yes" (or, if you prefer, you can use "-X" on the ssh command line). Fragment from both local and remote machine's ~/.bashrc

# If running interactively, then:
if [ "$PS1" ]; then

     ...

    if [ -z "$DISPLAY" ]; then
        export DISPLAY=:0.0
    fi
fi

Contents of remote file ~/.ssh/rc

if read proto cookie && [ -n "$DISPLAY" ]; then
    if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
        # X11UseLocalhost=yes
        /usr/X11R6/bin/xauth -i add unix:`echo $DISPLAY | \
            cut -c11-` $proto $cookie
    else
        # X11UseLocalhost=no
        /usr/X11R6/bin/xauth -i add $DISPLAY $proto $cookie
    fi
fi


[ Reply to This | # ]