Thinking Out Loud

August 21, 2015

X-Window Fun

Filed under: Uncategorized — mdinh @ 8:43 pm

When ssh -X to another host, I am able to use X-Windows.

[dinh@ca01ts~]$ ssh -X dinh@192.168.1.137
dinh@192.168.1.137's password:
Last login: Fri Aug 21 11:55:47 2015 from 10.237.102.38
/usr/bin/xauth: creating new authority file /home/dinh/.Xauthority
[dinh@arrow ~]$ xclock
Warning: Missing charsets in String to FontSet conversion
^C

However, sudo to another user and X-Windows breaks.

[dinh@arrow ~]$ sudo su - oracle
[sudo] password for dinh:
[oracle@arrow ~]$ xclock
X11 connection rejected because of wrong authentication.
X connection to localhost:10.0 broken (explicit kill or server shutdown).
[oracle@arrow ~]$

Work Around:

Just list the xauth.

[dinh@arrow ~]$ xauth list
arrow/unix:10 MIT-MAGIC-COOKIE-1 8dfb6c468329ff0d5f5d962b094a82d3

Magic is here.

[dinh@arrow ~]$ xauth list | grep unix`echo $DISPLAY | cut -c10-12` > /tmp/xauth
[dinh@arrow ~]$ sudo su - oracle
[sudo] password for dinh:
[oracle@arrow ~]$ xauth add `cat /tmp/xauth`
xauth: creating new authority file /home/oracle/.Xauthority
[oracle@arrow ~]$ xclock
Warning: Missing charsets in String to FontSet conversion
^C

BINGO!

Advertisements

1 Comment »

  1. Hello my friend! I want to say that this article is amazing,
    great written and include almost all important infos. I’d like to see extra posts
    like this .

    Comment by eksploatacja biologicznej oczyszczalni ścieków frukko — December 17, 2015 @ 9:58 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: