X11 (Port Forwarding)
How to get X11 windows to open when logged in remotely - e.g. how to get a web browser window on a remote server, when logged in via SSH.
Forwarding on MacOS with Vagrant
Note: Not sure how much of this is required, but after much hacking and frustration, I eventually managed to get it working using this method.
-
Install XQuartz and run it.
- On the remote machine, edit
/etc/ssh/sshd_configand set the properties:X11Forwarding yesX11DisplayOffset 10X11UseLocalhost no
-
On the remote machine, install X11 tools:
yum install xorg-x11-xauth -
Restart
sshdif necessary on the remote host. -
On the local machine, edit
~/.ssh/configto set:Host * XAuthLocation /opt/X11/bin/xauth ForwardX11 yes ForwardX11Trusted yes vagrant ssh -- -X
NB: If X11 forwarding is required for a user other than vagrant, then copy the file ~vagrant/.Xauthority into to the other user’s home directory:
sudo cp ~vagrant/.Xauthority ~jboss/
sudo chown jboss:jboss ~jboss/.Xauthority
sudo su - myuser
export DISPLAY=127.0.0.1:10.0