PROBLEM
You want to access a GUI-based software that is installed in a GCE instance without using NoMachine.
SOLUTION
GCE Instance (One Time Configuration)
Ensure X11Forwarding is enabled and set to yes. If not, change it.
grep X11Forwarding /etc/ssh/sshd_config
If a change is made to this file, restart the service.
sudo systemctl restart sshd
Mac (One Time Configuration)
Apple no longer include X11 since OS X 10.8 Mountain Lion. So, you need to install XQuartz, which is an open source version of X.
Using Homebrew, install XQuartz.
brew install xquartz
Reboot the machine. If you don’t reboot, it will not work.
Once rebooted, add the following line to ~/.ssh/config. If this file does not exist, create it.
ForwardX11 yes
This configuration prevents us from explicitly passing the -X option to the SSH command.
Accessing GUI-based software from Mac
Log into GCP.
gcloud auth login
SSH into the GCE instance.
gcloud compute ssh [INSTANCE] --project [PROJECT] --zone [ZONE]
Once you are in the GCE instance, run any GUI-based software from the command line.
Leave a Reply