skip to Main Content

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.

4

Answers


  1. 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.

    Login or Signup to reply.
  2. You logged into your Linux server over ssh and got the following error;

    .Xauthority does not exist
    

    Solution :
    Let’s go into the /etc/ssh/sshd_config file and remove the # sign at the beginning of the 3 lines below

    X11Forwarding yes
    X11DisplayOffset 10
    X11UseLocalhost yes
    

    Then systemctl restart sshd

    Login again and you will not get the error.

    Login or Signup to reply.
  3. I encountered a similar issue when I attempted to add a new user to a remote machine, but forgot to grant the user sudo privileges during the creation process.

    You can resolve the problem by logging in as the root user or a user with sudo privileges and assigning sudo privileges to the new user using the command:

    sudo usermod -aG sudo [newUser]
    

    To ensure the changes took effect, log out of the new user account and log back in via SSH to the server.

    Login or Signup to reply.
  4. There are many solutions to this problem, it can also depend on what machine you originate from. If you come from a Linux box, enabling sshd config options like:

    X11Forwarding yes
    

    could be enough.

    When you use a Macbook however the scenario is different. In that case, you need to install xQuartz with brew:

    brew install xquartz
    

    And after this start it:
    xQuartz &

    After this is done the xQuartz logo appears in your bar and you can right-click the icon and start the terminal from the Applications menu. After you perform this you can run the following:

    echo $DISPLAY from this terminal. This should give you the output:

        :0
    

    When you have another terminal such as iTerm, you can export this value in another terminal with export DISPLAY=:0 As long as xQuartz is still running the other terminal should be able to continue to use xQuartz.

    After this you can SSH into the remote machine and check if the display variable is set:

    $: ssh -Y anldisr@my-remote-machine
    $: echo $DISPLAY
    localhost:11.0
    

    It took me a hour to figure this out, hope it helps someone. 🙂

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search