Thank you for supporting the Cloud Customer Connect Community in 2024. It's a gift to work with you!

Look back
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

OCI: How to Use sudo/su in Combination with xhost and x11forwarding

in Linux 1 comment

Applies to

Oracle Cloud Infrastructure

Linux OS - Version Oracle Linux 7.0 to Oracle Linux 7.9 [Release OL7 to OL7U9]

Linux x86-64

Goal

How to use sudo/su in combination with x11forwarding on Oracle Linux 7

 

Solution

  •  As root, install necessary packages
  $ yum install xclock xorg-x11-xauth

      

  •    Login as user "opc" and create an export for user "oracle"
   $ mkdir .xauth
   $ echo oracle > .xauth/export
   $ xauth list $DISPLAY
   testserver01/unix:10 MIT-MAGIC-COOKIE-1 8ae3testc90ef1test140a6ccbf64c1
   $ echo $DISPLAY
   localhost:10.0

     

  •    Then login to user "oracle"
   $ sudo su - oracle 

   or

   $ su - oracle

      

  • As user "oracle" do If "/home/oracle/.Xauthority" does not exist, the following error is shown

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!