Thursday, May 5, 2022

Setup X11 forwarding on Oracle OCI (or Oracle JCS VM) - Oracle Linux 7

In general, there are a variety of tools, that can be selected for using X11 forwarding from a Linux machine, in this article I am using MobaXterm, as this tool have some very good features on top of a standard putty and related utilities.

 Connect to OCI VM via MobaXterm, most likely you will see X11 forwarding disabled by default.

Steps to be taken to make sure X11 forwarding is enabled on the  OCI VM :

  1. Log into the VM and sudo -s root, if you are not root.
  2. Configure SSHD to not to check if X11 forwarding is enabled:
    1. cd /etc/ssh
    2. vi sshd_config
    3. Check if the property X11Forwarding is set to yes.
    4. Add AddressFamily inet in the list


    5. Save the file
    6. Restart the ssh daemon by executing: systemctl restart sshd
  3. Install xauth by executing: yum -y install xauth
  4. Install xterm (used to verify X configuration) by executing yum -y install xterm
  5. Also install xclock for simple testing of the X Forwarding: yum -y install xclock

 Once the above activities are completed close the session and open a new session in MobaXterm, this time you should see xauth error by default as the folder doesn't exists, you can ignore that and run xclock(It is automatically created behind the scenes).

 

 But what if I want to run x11 forwarding as oracle user? Lets’ see what happens


Now, we focus on second problem:  the reason for  not setting DISPLAY , because display was only set for the original user which was used to connect session with MobaXterm. Do, these steps in order to set X11 forwarding for any user you switched after connecting to MobaXterm initially :

1.     Connect with default user, say opc.

2.     Type xclock , to check if display is working fine for the opc user.

3.      Type echo $DISPLAY



4.     Type xauth list $DISPLAY


5.      Now, switch to a different user , say oracle sudo su – oracle

6.      Upload export variable: export DISPLAY=localhost:11.0

7.     Add the cookie session reference to current user:

xauth add <output of step #4>

xauth add xxxx-wls-1/unix:10  MIT-MAGIC-COOKIE-1  dd413b3fb2aea0e4cd60f504c2893fcf

            and that’s it after this you will be able to run xclock.

1 comment:

Triotech Software said...

Great information, Oracle Fusion HCM Online Training
on Cloud applications help organizations manage human resource