Tuesday, February 1, 2011

x forwarding and sudo for oracle installs

From my linux desktop I ssh to my oracle box and forward X packets back to my desktop over ssh.

bill@wgwsvm:~$ ssh -X 192.168.56.101


When I invoke xclock this works like you would expect.

If I wanted to forward xpackets from other users that I might ssh to I have to do two additional steps. Obviously set the DISPLAY and additionally set the x auth token to forward through the connection.

bill@wgdbvm:/home/bill> xauth list
wgdbvm/unix:10 MIT-MAGIC-COOKIE-1 4696e4a4a52fac8af8b85e42195baa84
bill@wgdbvm:/home/bill> echo $DISPLAY
localhost:10.0
bill@wgdbvm:/home/bill> sudo su - oracle
[sudo] password for bill:
oracle@wgdbvm:/home/oracle> xauth add wgdbvm/unix:10 MIT-MAGIC-COOKIE-1 4696e4a4a52fac8af8b85e42195baa84
oracle@wgdbvm:/home/oracle> export DISPLAY=localhost:10.0




One note, when disconnecting from my bill account the xauth file is cleaned up automatically for me. But oracle's xauth will still contain the token, so it needs to be deleted manually.


oracle@wgdbvm:/home/oracle> xauth list
wgdbvm/unix:10 MIT-MAGIC-COOKIE-1 4696e4a4a52fac8af8b85e42195baa84
oracle@wgdbvm:/home/oracle> xauth remove wgdbvm/unix:10

No comments: