How to set the DISPLAY variable
From Wiki-UX.info
The DISPLAY variable can be a little confusing to set-up. This variable allows X application to stablish the connection to X Server. This is normally use to start X application in local X server emulators like Reflection-X.
This piece of code can be added to the current user ".profile" enviroment or to all the users on /etc/profile so the proper variable is set after each ssh logging.
if [ ${DISPLAY:-setdisplay} = setdisplay ]
then
# irix sets REMOTEHOST
if [ ${REMOTEHOST:-islocal} != islocal ]
then
DISPLAY=${REMOTEHOST}:0
else
if [ "${SSH_CLIENT:-notssh}" != "notssh" ]
then
echo "Warning: using ssh w/o X11 fwd"
DISPLAY=`echo "$SSH_CLIENT" | sed -e 's/ .*/:0.0/'`
else
# Try to guess DISPLAY
case $ARCH in
sunos-sun4|osf-alpha)
TTY=`tty | sed 's:/dev/::'`
DISPLAY=`who am i | grep $TTY | tail -1 | \
sed -e 's/.*(//' -e 's/[\.)].*//'`:0.0
;;
irix-mips)
DISPLAY=:0.0
;;
*)
DISPLAY=`who am i | sed -e 's/^.*(//' -e 's/[:)].*//'`:0.0
;;
esac
fi
fi
export DISPLAY
fi
If you get the script error message "Warning: using ssh w/o X11 fwd" that means that the X session will not use ssh encryption. For more secure connection, check your ssh client.