Tille - I can see you, read those man pages!   Tille's Site

Setting the DISPLAY variable automatically

Config for the user who gives access

The user who gives access is the one who owns the display. Find out who this is issuing the w command and spot the user marked with console in the tty field. This user can add the following code to her/his .bashrc file:

xhost | grep localhost > /dev/null
if [ $? -eq 0 ]; then
echo "display permissions are set"
else
echo "setting display access"; xhost +localhost
fi

Config for the user who needs access

Say that you need to switch to the root account a lot, put this in root's .bashrc file:

export DISPLAY=localhost:0

If you use sh instead of bash (or ksh if you insist), split up this command:

DISPLAY=localhost:0.0
export DISPLAY
Home
© 1995-2010 Machtelt Garrels - tille - Powered by vIm - Best viewed with your eyes - Validated by W3C - Last update 20100511