You'll have to enable X11 forwarding for the PuTTY connection. In the configuration dialog, select Connection -> SSH -> X11, and check the "Enable X11 forwarding" option. Afterwards, when you enter the command echo $DISPLAY you should see some output similar to DISPLAY=localhost:10.0
When you log in, your display information is set. When you su, that information gets lost. It is possible though to make this work.
Here is the script I use. You will have to modify it. But hopefully you can understand what needs to be done:
Code:
#!/usr/bin/ksh93
#
# Name:
#
# Purpose:
#
# Type:
#
# Date:
#
# Required Parameters:
# -------------------------------------------------------------------------
# None.
#
# Optional Parameters:
# -------------------------------------------------------------------------
# None.
#
# Change History:
#
# Date Name Comments
# _________________________________________________________________________
# 30 jan 2004 purdym changed
# xauth extract ~/.ssh.display $DIS_HOST:$DIS_NUM
# to
# xauth extract ~/.ssh.display :$DIS_NUM
#
# changed all /home/ and ~ to /u/$USER
#
# 8 jun 2006 purdym updated to ksh93
# xauth extract ~/.ssh.display $DIS_HOST:$DIS_NUM
# KEY=`xauth -i list $DISPLAY 2>/dev/null`
#
# 14 jun 2006 purdym added:
# DIS_HOST=""
# DIS_NUM=0
#
#
#
# 18 jul 2006 purdym changed:
# xauth -bi merge /u/${USER}/.ssh.display
# xauth extract /u/$USER/.ssh.display :$DIS_NUM
# to:
# xauth -bi merge ${HOME}/.ssh.display
# xauth extract ${HOME}/.ssh.display :$DIS_NUM
#
#
#
# 19 oct 2010 purdym removed:
#
#
# WARNING:
#
# It looks like you are using SSH.
# This is a good thing, but your XWindows may not
# work properly, especially if you switch user to root.
# Not only do have to set the display, but there is key to unlock the display.
# Please verify that your display is set to the hostname
# or localhost and the display number is greater than or equal to 2.
# Your display host is: $DIS_HOST
# Your display number is: $DIS_NUM
# Your KEY is: $KEY
# Your key file is: $KEY_FILE
# Your command file is: $COMMAND_FILE
#
#
#
#
#
#
###################################################################################
# Variables
###################################################################################
PROGRAM_NAME=$0
set_variables
KEY_FILE=/tmp/.${0##*/}.$USER.display_key.$$
COMMAND_FILE=/tmp/.${0##*/}.$USER.setup_display.$$
HOSTNAME=$(hostname)
DIS_HOST=""
integer DIS_NUM=0
RETCODE1=$?; if (( $RETCODE != 0 )); then RETCODE=$RETCODE1; fi
###################################################################################
# Main Line Here
###################################################################################
print "\nChecking for SSH connection....\c"
DIS_HOST=`print $DISPLAY | cut -d ":" -f1`
DIS_NUM=`print $DISPLAY | cut -d ":" -f2`
(( $DEBUG == $TRUE )) && print "DEBUG: DIS_HOS: $DIS_HOST"
(( $DEBUG == $TRUE )) && print "DEBUG: DIS_NUM: $DIS_NUM"
if (( DIS_NUM > 0 ))
then
alias ls='/usr/local/bin/lsc --color=auto'
xauth extract $KEY_FILE :$DIS_NUM
KEY=`xauth -i list $HOSTNAME/unix:$DIS_NUM 2>/dev/null | awk '{print $3}'`
print "yes!" # green on and off
cat <<EOF
Examples:
In general:
Get the key, then re-export your display:
xauth -bi merge $KEY_FILE
DISPLAY=$DISPLAY; export DISPLAY
-=OR=-
you can run this script: $COMMAND_FILE
As Root:
. $COMMAND_FILE
As Sybase:
If you want to use the sybase account,
you must change the permissions on the key file and run the command file. Run:
su - root
chmod g+r $KEY_FILE
chmod g+rx $COMMAND_FILE
su - sybase
. $COMMAND_FILE
EOF
###################################################################################
# create a script!
###################################################################################
cat <<EOF >$COMMAND_FILE
#!/usr/bin/ksh
xauth -bi merge $KEY_FILE
DISPLAY=$DISPLAY
export DISPLAY
EOF
chmod 500 $COMMAND_FILE
else
print "none found. \n If this is in error, then X11 tunnelling is not configured."
fi
###################################################################################
# exit
###################################################################################
# do not exit this script
set_varaibles is function I wrote.
Notice the xauth comamnds.
In your own .profile, you must run the above script.
ie:
Code:
/etc/profile.ssh.check
When I log in, I see:
Code:
Checking for SSH connection....yes!
Examples:
In general:
Get the key, then re-export your display:
xauth -bi merge /tmp/.profile.ssh.check.AIX.purdym.display_key.905454
DISPLAY=localhost:15.0; export DISPLAY
-=OR=-
you can run this script: /tmp/.profile.ssh.check.AIX.purdym.setup_display.905454
As Root:
. /tmp/.profile.ssh.check.AIX.purdym.setup_display.905454
As Sybase:
If you want to use the sybase account,
you must change the permissions on the key file and run the command file. Run:
su - root
chmod g+r /tmp/.profile.ssh.check.AIX.purdym.display_key.905454
chmod g+rx /tmp/.profile.ssh.check.AIX.purdym.setup_display.905454
su - sybase
. /tmp/.profile.ssh.check.AIX.purdym.setup_display.905454
ms:/u/purdym>
Notice how you have to log in, su to root, change the perms on your key file, su to the next user, then source the key file.
Here is a full example:
Code:
Checking for SSH connection....yes!
Examples:
In general:
Get the key, then re-export your display:
xauth -bi merge /tmp/.profile.ssh.check.AIX.purdym.display_key.704600
DISPLAY=localhost:16.0; export DISPLAY
-=OR=-
you can run this script: /tmp/.profile.ssh.check.AIX.purdym.setup_display.704600
As Root:
. /tmp/.profile.ssh.check.AIX.purdym.setup_display.704600
As Sybase:
If you want to use the sybase account,
you must change the permissions on the key file and run the command file. Run:
su - root
chmod g+r /tmp/.profile.ssh.check.AIX.purdym.display_key.704600
chmod g+rx /tmp/.profile.ssh.check.AIX.purdym.setup_display.704600
su - sybase
. /tmp/.profile.ssh.check.AIX.purdym.setup_display.704600
ms:/u/purdym>
ms:/u/purdym>echo $DISPLAY
localhost:16.0
Now su to root:
ms:/u/purdym>su -
root's Password:
KeyChain 1.0
* Found existing ssh-agent at PID 266338
Would you like to set your term to colour xterm (Y/n)?:
Looking for a TGT...ok.
root@ms:/>echo $DISPLAY
# notice root has no display
root@ms:/>. /tmp/.profile.ssh.check.AIX.purdym.setup_display.704600
root@ms:/>echo $DISPLAY
localhost:16.0
# now root has my display
root@ms:/>chmod g+r /tmp/.profile.ssh.check.AIX.purdym.display_key.704600
root@ms:/>chmod g+rx /tmp/.profile.ssh.check.AIX.purdym.setup_display.704600
# su to sybase
root@ms:/>su - sybase
sybase@ms:/home/sybase>echo $DISPLAY
# notice Sybase has no display
sybase@ms:/home/sybase>. /tmp/.profile.ssh.check.AIX.purdym.setup_display.704600
1356-364 xauth: creating new authority file /home/sybase/.Xauthority
sybase@ms:/home/sybase>echo $DISPLAY
localhost:16.0
sybase@ms:/home/sybase>
# now sybase has my display
Thanks.
The questions :
for oracle user (as I do : su - oracle)
1-is DISPLAY=IP_OF_MYWindowsWorkStation:X.X
2-How to find correct XX (in line above) ?
Regards.
The reason for scripting this mess and to answer your question: it's not that simple.
Simply knowing the display of your workstation is not good enough. Another user can not write to your display, unless you give them permission.
I will answer your question, your display doesn't change.
Notice in my example, that as myself: DISPLAY=localhost16:0
Then AFTER root imports my X key (as I call it): DISPLAY=localhost16:0
Then AFTER root grant permissions,su to sybase, ...: DISPLAY=localhost16:0
Please log in, and with out su'ing, type:
Code:
echo $DISPLAY
If DISPLAY is not set, X11 tunneling is not configured. Fix this first.
Hi All,
I use "export DISPLAY=same_host:0.0" to set my export DISPLAY and it is working fine for me..
Problem here is I have developed a script for which i should run export DISPLAY prior to running my script....
so my script should check whether export DISPLAY is set or not.. if... (6 Replies)
hello frnds,
I want to export display of othe terminal to my terminal and want to post a msg, which should visible at other terminal,
I tried myself, but couldnt get it
plz help me to get solution (1 Reply)
HI,
HP-UX B.11.00 A 9000/785 (ta)
I am trying to export a display using Xming & and Telnet (not SSH) but when I try..
$ DISPLAY=192.168.1.75:0.0
$ export DISPLAY
$ xclock
and get..
Xlib: connection to "192.168.1.75:0.0" refused by server
Xlib: No protocol specified
Error:... (4 Replies)
Hi Frnds,
i face a peculiar issue.
I am managing 200 Aix workstations and 20 sun boxes.
I am not anle to export the display from aix workstations to sun box,
But vice versa it is working fine.
But if i try to export the display to a sun box from other sun box it works perfectly.
Could... (3 Replies)
hi
I wanted to export the display of all directories of home with their respective subdirectories and files if any on my local pc.
this home directory is of some remote machine .
using ssh remote login and then using struct direct i can just gate name list of directories .
but not the display... (2 Replies)
I'm trying to open an xwindow on my Sun server. What am I doing wrong?
# echo $SHELL
/sbin/sh
#
# export DISPLAY=localhost:0.0
DISPLAY=localhost:0.0: is not an identifier
Thank you! (1 Reply)
hello to begin i sorry for my english because i'am french so:
someone can explain me to do a export DIPLAY with a web page (php)
i have test the php function exec (myscriptshell.sh) but he can't do the export diplay. if someone have a solution .
bye (1 Reply)
Hi!
I´ve an application that runs in a Digital Tru64, exporting display to a Linux host.
That application blinks a icon (in XPM mode) when the severity mode changes.
When I put a backdrop(XPM, too) in that screen, the icons blink slowly. When I remove it, they turn to blink quickly.
I have... (3 Replies)