[SunHELP] $DISPLAY for root
    David Baldwin 
    sunhelp at sunhelp.org
       
    Fri Aug 17 09:09:55 CDT 2001
    
    
  
I threw that snip in my /etc/profile but when I ". /etc/profile" I get a
syntax error.  ( is unexpected.  I checked that they all match up
properly but I can't find where the problem is.  I am working on my
shell scripting but I am by no means good at it.  Is there something
else that needs to happen first?
Thanks for all the help
Dave Baldwin
-----Original Message-----
From: David Ledger [mailto:dledger at ivdcs.demon.co.uk]=20
Sent: Thursday, August 16, 2001 6:56 AM
To: sunhelp at sunhelp.org
Subject: RE: [SunHELP] $DISPLAY for root
>
>  > >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=3D${DISPLAY[$((${#DISPLAY[*]} - 1))]}
	       DISPLAY=3D${DISPLAY%:0.0}:0.0
	       export DISPLAY
should do it.  My .profile calls a script that does the above first,=20
and if that fails to give an answer it looks up the process tree to=20
find the xterm process.  My xterm starter scripts always use the=20
-display as the first parameter so it appears in a ps list for that=20
reason.
David.
--=20
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
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp
    
    
More information about the SunHELP
mailing list