Ssh into a stroller with X server setup

I'm having problems setting up X11 forwarding to a virtual virtual machine.

I am running Xming for the X server and PuTTY as my SSH client.

This is what I get when I run vagrant ssh-config :

 Host default HostName 127.0.0.1 User vagrant Port 2200 UserKnownHostsFile /dev/null StrictHostKeyChecking no PasswordAuthentication no IdentityFile C:/Users/MyName/.vagrant.d/insecure_private_key IdentitiesOnly yes LogLevel FATAL ForwardAgent yes ForwardX11 yes 

X11 forwarding is included in My PuTTY, and X's display location is set to 0.0 .

When I do echo $DISPLAY , I get no response.

I am not sure what I configured incorrectly. I followed the following tips in setting up my PuTTY client. If there is an easier way to set up an X11 forwarding virtual machine, please let me know.

For reference, this is the contents of my Vagrantfile .

 VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.ssh.forward_agent = true config.ssh.forward_x11 = true end 
+8
windows putty vagrant ssh xming
source share
3 answers

Install Cygwin with the following packages to solve the problem indicated on this website :

  • Xorg server
  • xinit
  • xorg-docs (for documentation)
  • openssh (if it was not installed earlier)

Then load the window using startxwin from the cygwin terminal.

The note that I discovered later is that ssh is better at a tramp using the following command:

vagrant -Y ssh

than:

vagrant -X ssh

The latter is executed in unreliable mode, as in this one, and expires after a while.

+3
source share

I had a very similar problem, but in my case it was a problem with Vagrant VM. Here are some things to check:

  • X11Forwarding must be set to yes in /etc/ssh/sshd_config
  • Enable verbose logging for ssh ( vagrant ssh -- -vvv -X on Linux, Putty also has the -v command line -v ) and look for interesting messages.

With my Vagrant VM, the latter showed the following message:

 debug1: Remote: No xauth program; cannot forward with spoofing 

After installing the package that xauth provides ( xorg-xauth , xorg-x11-xauth or similar), vagrant ssh -- -X worked fine.

+6
source share

Use "startxwin" to start the cygwin X server. Use putty or cygwin ssh client for ssh for your guest virtual machine.

If you are using cygwin ssh, do "export DISPLAY =: 0" before running ssh (ie, "vagrant ssh - -vvv -X").

For putty: run "startxwin - -listen tcp", enable ssh-X11 forwarding in the connection configuration of the sleepers, set "X display location" to "localhost: 0" and set the correct path to the .Xauthority file (see, this is probably in your home directory, the output of startxwin will tell you where).

Maybe do not use msys2 ssh (the default firewall environment is msys2, but the tramp also works fine under cygwin) with the cygwin X server (see details for details).

More details:

If you get "connect / tmp / .X11-unix / X0: there is no such file or directory" (in ssh detailed help mode) or a sleeper error "PuTTY X11 proxy server: cannot connect to the forwarded server X: network error: connection failed ", try using tcp sockets instead of standard unix domain sockets.

When you start your Cygwin X server, go to "X -listen tcp -multiwindow" (multiwindow is optional - it opens new windows for each application).

If you use openssh "ssh" from the command line: before going "vagrant ssh - -vvv -X", go to "export DISPLAY = localhost: 0" (not ": 0", but "localhost: 0", therefore he uses tcp). I am running git bash that uses msys2, which does not seem to communicate correctly with my cygwin X server via emulated unix domain sockets. But if I use "vagrant ssh - X" in my cygwin hint (with DISPLAY =: 0 for unix domain sockets), it works.

Great source of information: http://dustwell.com/how-x-over-ssh-really-works.html

Alternatively, you can add "config.ssh.forward_x11 = true" to your Vagrantfile. I think this installs X11Forwarding in / etc / ssh / sshd _config when a guest virtual machine is configured or a "roaming reboot" is started. - https://coderwall.com/p/ozhfva/run-graphical-programs-within-vagrantboxes

Update. It is not recommended to run X without xauth security (as shown above). It's not safe. For example, other computers on the same LAN can connect to your x-server via tcp and sniff your keystrokes with xkeys. Use "startxwin" instead of starting X directly, so it uses the "-auth" option of XWin. This makes it difficult for me to force my msys2 ssh to redirect X to my cygwin X server. The ssh log when connected says that it cannot find the xauth command - this is because it is not in my msys2 environment. Cygwin ssh X-redirection is still working fine. Putty works fine if you set the path of the .Xauthority file (this is probably correct in your home directory) in the putty session configuration.

I found that the tcp / unix-domain socket problem / solution is indeed located in cygwin faq (this faq is quite useful and has a lot of information):

6.7. X PuTTY redirected sessions cannot be connected. Non-bank local X clients cannot connect.

Server X now uses -nolisten tcp by default, which increases the security of the X server by not opening the TCP / IP socket, but only the local (UNIX domain). Non-cygwin-related applications cannot connect to this socket.

https://x.cygwin.com/docs/faq/cygwin-x-faq.html

+1
source share

All Articles