The .xauthority file is not does not exist;hence via local ssh connection display from the GCP compute engine not working

Trapti Kalra picture Trapti Kalra · May 4, 2020 · Viewed 23.8k times · Source

explaining all that has been tried and double checked.

Set up on local windows machine:

  1. Xming installed and running.

  2. in ssh_config ForwardX11 is set to yes.

  3. In VS code remote connection config the the Forward X11 is set to yes.

Set up on GCP compute engine with Debian / Linux 9 and 1 GPU[free tier]:

  1. xauth is installed.

  2. In the sshd_config file below is set: X11Forwarding yes X11DisplayOffset 10 X11UseLocalhost no

The sshserver has be restarted to ensure below setting are read . from local workstation I fire gcloud compute ssh --ssh-flag="-X" tensorflow-2-vm(instance name) and the response is :

/usr/bin/xauth: file /home/user/.Xauthority does not exist,

So, I attempted to perform the below on the remote compute engine with instance name - tensorflow-2-vm and user trapti_kalra:

trapti_kalra@tensorflow-2-vm:~$ xauth list
xauth:  file /home/trapti_kalra/.Xauthority does not exist
trapti_kalra@tensorflow-2-vm:~$ mv .Xauthority old.Xauthority
mv: cannot stat '.Xauthority': No such file or directory
trapti_kalra@tensorflow-2-vm:~$ touch ~/.Xauthority
trapti_kalra@tensorflow-2-vm:~$ xauth generate :0 . trusted 
xauth: (argv):1:  unable to open display ":0".
trapti_kalra@tensorflow-2-vm:~$ sudo xauth generate :0 . trusted 
xauth:  file /root/.Xauthority does not exist
xauth: (argv):1:  unable to open display ":0".

so, looks like something is missing, any help will be appreciated. This was working with a EC2 server before I moved to GCP.

Answer

Karel picture Karel · Nov 25, 2020

Create n new file: touch ~/.Xauthority Log out and back in again with your ssh session. (I'm using MobaXterm) Then it writes the needed.