-
SSH + X11 display after su to another user
Posted on January 26th, 2010 Add commentsSometimes we need to run the X11 application window via SSH. For example, I am user “A”, and SSH to host “example”. To be possible running X11 application window, we need to type the command:
#ssh -Y A@example
In addition to the SSH restriction, we need to run an X application as someone other than yourself. For example, the Virtualbox can be only run by user “B”. If the user “A” can sudo to become user “B” or “A” is the root, in order to allow user “B” access to user “A”’s display, B needs to import “A”’s
.Xauthority
cookie. We can usexauth
to accomplish this and it’s a quick one-liner beforesudo su - B
:
441 viewsA@example:~#xauth extract – :`echo $DISPLAY |awk -F: ‘{print $2}’` | sudo su – B -c “/usr/bin/xauth merge -”
A@example:~#sudo su – B
B@example:~#VirtualBox &
Leave a Reply
Be the First to Comment!