[SunHELP] $DISPLAY for root
David Ledger
sunhelp at sunhelp.org
Thu Aug 16 00:55:48 CDT 2001
>
> > >Hi,
>> >When I "su -" to any user the display is not set.
>> >I can't remember if this was happening always but I
>> started noticing it
>> >after installing ssh and enabling X11 forwarding.
>> >Note: this happens even when ssh is not in use.
>> >Thanks for any help or suggestions, always
>> appreciated.
>> >
> > >Dave Baldwin
# Set the DISPLAY global environment variable.
if [ ! "$DISPLAY" ]; then
set -A DISPLAY $(who -um)
DISPLAY=${DISPLAY[$((${#DISPLAY[*]} - 1))]}
DISPLAY=${DISPLAY%:0.0}:0.0
export DISPLAY
should do it. My .profile calls a script that does the above first,
and if that fails to give an answer it looks up the process tree to
find the xterm process. My xterm starter scripts always use the
-display as the first parameter so it appears in a ps list for that
reason.
David.
--
David Ledger - Freelance Unix Sysadmin in the UK.
Chair of SysAdmin SIG of HP/Works technical user group
dledger at ivdcs.co.uk (also dledger at ivdcs.demon.co.uk)
www.ivdcs.co.uk
More information about the SunHELP
mailing list