DISPLAY=local_host:0.0 ; export DISPLAY

Hi,
from my Windows Workstation I can connect with PUTTY to an AIX 6.1 unix server.

On AIX via PUTTY I run DBCA which has a grphical interface.
Then :

#DISPLAY=local_host:0.0 ; export DISPLAY
$(hostname) $(whoami):/appli/oracle/product/10.2.0/db_1/bin#dbca
_X11TransSocketINETConnect() can't get address for local_host:6000: Hostname and service name not provided or found

How to rectify this error ?
Thank you.

What do you mean by "local_host" ?
If it is the name of a host that is local on your network, then you need to add that machine to the DNS or /etc/hosts so that it is recognised.
If you mean "localhost", then you have made a typo.
Cheers.

Thank you. I rectified :

#DISPLAY=localhost:0.0 ; export DISPLAY
$(hostname) $(whoami):/appli/oracle#dbca
Exception in thread "main" 

Any idea ?

On the other hand should I install any software (X server for Windows for example : X-Ming) on my workstation ?

Regards.

Ah right. Yes, you will definitely need an X-Windows emulator for your workstation. If you then access the AIX box using their emulator it is usual that your DISPLAY variable will be set correctly, and any Xauthority security, and you should then be able to start the graphical appllication.

I installed Xming but :

In putty (for DBCA nothing happens):

DISPLAY=localhost:0.0 ; export DISPLAY
 
$(hostname) $(whoami):/appli/oracle#dbca
Exception in thread "main" $(hostname) $(whoami):/appli/oracle#dbca
 
$(hostname) $(whoami):/appli/oracle#xclock
Error: Can't open display: localhost:0.0

Regards.

No...."localhost" means the X-Windows display on the host you are logged into.
Usually you would set the DISPLAY to be the IP address of the workstation you are logged in from. For example your workstation may be 192.168.1.1 and the AIX server you are logged into is 192.168.1.2. In this instance you would set your DISPLAY=192.168.1.1:0

Again, usually the X-Windows emulation software will give you an option to set the DISPLAY variable automatically. Also X-Windows security is important. Again the emulator should sort that for you (look for options using Xauthority or xauth).

Hi,
big123456, did you resolve this?

Please log into your server and without running anything else, type:

echo $DISPLAY

And tell me what it says.

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

Thank you.

root:/root#echo $DISPLAY

 root:/root#su - oracle
`hostname`@oracle$echo $DISPLAY

`hostname`@oracle$

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:

#!/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:

/etc/profile.ssh.check

When I log in, I see:

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:

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:

echo $DISPLAY

If DISPLAY is not set, X11 tunneling is not configured. Fix this first.

Thanks.
In my PUTTY , I enabled X11 forwarding and now I have
echo $DISPLAY
localhost:11.0

And Xclock sends a clock windwos on my workstation.

Thanks and Regards.