OCI: Enabling X11 Forwarding on an Oracle Linux instance

I was connecting to one of my works servers the other day hoping to copy the contents of a file into my clipboard, which would require the use of an X11 forwarded session, but as I connected to the server with X11 forwarding enabled, I was sad to see the following message:

X11 forwarding request failed on channel 0

This is on Oracle Linux.

Note, if I connect to an Ubuntu instance, I get the message:

/usr/bin/xauth:  file /home/ubuntu/.Xauthority does not exist


But this file is created, and X forwarding works from the get-go.

OK, back to Oracle Linux - how do we fix this?

Actually, the fix is a simple one.

SSH is already configured to enable X11Forwarding. The other change you need make is to turn off the setting X11UseLocalhost. So part of your configuration would likely look like this:

X11Forwarding yes
#X11DisplayOffset 10
X11UseLocalhost no

After that, you will want to reload the SSH daemon. Do this by running the command:

sudo systemctl reload sshd

Finally, you need to install xauth. This is enabled through the package xorg-x11-xauth.

sudo yum install xorg-x11-xauth

The next time you connect to the server, you should see the file .Xauthority in your home directory. And you will be able to run any X apps remotely.

You connect to the server with the X flag:

ssh -X opc@server



For what it's worth, you use the xclip package to copy the contents of files.

So, for example, to copy the sshd_config, you would run:

cat /etc/ssh/sshd_config  | xclip -selection c 


Popular posts from this blog

Report row buttons firing a dynamic action

Accessing the last request value from a page submission

Installing Oracle Instant Client on Ubuntu