How to enable SSH X-11 forwarding and magic cookies
Basically, whenever the any new database server provision by
server admin team, X11 setup is not there, we are getting below error :
X11 connection rejected because of
wrong authentication.
Error: cannot open display:
localhost:12.0
So, how easily you can setup this
and enable GUI for server.
Once an SSH connection is established to server, the server will
generate a random authorization (xauth) cookie and store it in
~./Xauthority on the server, known as a MIT-MAGIC-COOKIE-1 entry.
Every time you login, a new cookie is generated, and because I’m
switching to another user, its lost. In order to access the local display
again, we need to add my cookie entry from the previous connection as below :
Initially, we
have to login server personal account ( If you have ) then sudo su - oracle or grid.
1)
Login to server with your personal account. ( ssh -Y sam.sam)
ssh -Y sam.sam
xauth list
2)
sudo su - oracle
3)
Check xauth rpm installed or not ?
[root@DB12345 ~]# yum install
*xauth*
Loaded plugins: product-id, search-disabled-repos, subscription-manager
Package 1:xorg-x11-xauth-1.0.9-1.el7.x86_64 already installed and latest version
Nothing to do
Loaded plugins: product-id, search-disabled-repos, subscription-manager
Package 1:xorg-x11-xauth-1.0.9-1.el7.x86_64 already installed and latest version
Nothing to do
4)
Check sshd configuration :
[root@DB12345 ~]# cat
/etc/ssh/sshd_config | grep -i x11
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
5)
Now add the xauth entry to your oracle or grid xauth file :
[sam.sam@local.local@DB12345 ~]$
xauth list
DB12345/unix:10 MIT-MAGIC-COOKIE-1 c01db4311132e3774648671401c03adf
DB12345/unix:10 MIT-MAGIC-COOKIE-1 c01db4311132e3774648671401c03adf
[oracle.oracle@local.local@DB12345 ~]$ xauth add DB12345/unix:10 MIT-MAGIC-COOKIE-1 c01db4311132e3774648671401c03adf
[oracle.oracle@local.local@DB12345 ~]$ xauth list
DB12345/unix:10 MIT-MAGIC-COOKIE-1 c01db4311132e3774648671401c03adf
6)
Export Display
[sam.sam@local.local@DB12345 ~]$
export DISPLAY=localhost:10.0
[sam.sam@local.local@DB12345 ~]$ echo $DISPLAY
7) Now check with xclock or xterm , are you getting GUI or not ?
[sam.sam@local.local@DB12345 ~]$ xclock
[sam.sam@local.local@DB12345 ~]$ xterm
Using GUI you can install GI , Oracle Software and DBCA , NETCA all oracle utility
0 Comments