Как заставить X11 Forwarding работать в Windows с PuTTY и Xming?

121843
NobleUplift

Я всегда хотел, чтобы X11 Forwarding работал с PuTTY, и система X Window, которую я использую, это Xming. Когда у меня работает Xming и я устанавливаю новое соединение с моим сервером, после команды я получаю следующее:

$ firefox PuTTY X11 proxy: wrong authentication protocol attemptedPuTTY X11 proxy: wrong authentication protocol attemptedError: cannot open display: localhost:10.168  $ google-chrome PuTTY X11 proxy: wrong authentication protocol attempted (google-chrome:7083): Gtk-WARNING **: cannot open display: localhost:10.168  $ gedit PuTTY X11 proxy: wrong authentication protocol attempted ** (gedit:6990): WARNING **: Could not open X display PuTTY X11 proxy: wrong authentication protocol attemptedCannot open display: Run 'gedit --help' to see a full list of available command line options.  $ gnome-system-monitor PuTTY X11 proxy: wrong authentication protocol attempted ** (gnome-system-monitor:7024): WARNING **: Could not open X display PuTTY X11 proxy: wrong authentication protocol attempted (gnome-system-monitor:7024): Gtk-WARNING **: cannot open display: localhost:10.168 

Как исправить эти ошибки и заставить пересылку X11 работать в целом?

16
Как это исправить? user568109 10 лет назад 0
Вы должны создать учетную запись, задать новый вопрос, а затем связать его здесь, чтобы я мог его увидеть. NobleUplift 10 лет назад 0

3 ответа на вопрос

16
sibaz

I had 2 problems and found this question had the closest problems to mine, so thought my solution would be helpful to others who get here, trying to fix the same problem as me. My system has Cygwin/X (xinit 1.3.4-5), and PuTTY (0.64). I managed to get to the bottom of it by setting both --listen tcp on the local startxbin and passing the path to .Xauthority to putty.

Firstly, in reference to the "PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused" error, you need to make the X session listen for connections: Open a cygwin terminal and edit /usr/bin/startxwin find the line...

defaultserverargs="-multiwindow" 

and change it to...

defaultserverargs="-multiwindow -listen tcp" 

Secondly, in response to the "Authorization required, but no authorization protocol specified" error, you need to make putty use the correct xauth tokens (something strange seems to go on inside putty so xauth list locally doesn't give tokens that the forwarded connection can use by passing them in xauth add <token>, they seem to need to be set by PuTTY on connection, in order for them to work).
Find the path, in the windows domain, where your ~/.Xauthority file is by running (in cygwin terminal again)

cd ~ explorer . 

Check out the properties on the .Xauthority file and make a note of the Location to it (select it and press CTRL+C to put it in clipboard).

Start PuTTY as in the example above (copied from http://www.math.umn.edu/systems_guide/putty_xwin32.html)

On the 'Options controlling SSH X11 forwarding' page, you should have 'Enable X11 forwarding' checked, and 'MIT-Magic-Cookie-1' set as the protocol.
Under the 'X authority file for local display' field, click Browse and using the Location to the .Xauthority file you made a note of earlier, find the .Xauthority file. Click Open to populate the field, then go back to Session (in PuTTY configuration) and save the session. Then you can click open.

It should now allow you to connect.

Мне также нужно было установить `авторитетный файл X для локального отображения`, чтобы он указывал на мою папку` .Xauthority` в моем домашнем каталоге `cygwin`. Спасибо! HeatfanJohn 8 лет назад 3
7
Kruug

Copied from: http://www.math.umn.edu/systems_guide/putty_xwin32.html

Configuring Putty

  • Add Unix hostname
  • Switch Protocol to SSH
  • Type name of session in saved sessions
  • Click 'Save'

<img src='putty_xwin32/default_putty_rev-sm.png'/>

  • Expand the 'SSH' tab from the 'Category' list
  • Choose 'X11' from 'SSH' list
  • Check 'Enable X11 Forwarding'

<img src='putty_xwin32/xfwd_putty_rev-sm.png'/>

  • Choose 'Session' from 'Category' list
  • Click 'Save'

Starting the X Server on Windows

Configuring Xming

Just run "All Programs > Xming Xming" and it should work if you've got PuTTY configured.

Connecting

  • Start Xming
  • Start Putty
  • Double click on the saved session you want

<img src='putty_xwin32/session_putty_rev-sm.png'/>

  • Enter username and password as requested
  • You should now be able to run X applications from the host on your local desktop

EDIT: To fix the wrong authentication protocol attempted error, try enabling “ForwardX11Trusted yes” in the /etc/ssh/sshd_config file and then restart the OpenSSH server.

Я буквально прочитал точно такое же руководство (это то, как я узнал о Xming), но нашел его совершенно бесполезным в противном случае, потому что оно либо рассказывало мне то, что я уже знал, либо мог выяснить, просто запустив две программы. NobleUplift 10 лет назад 0
Я был в состоянии заставить работать пересылку X11, но я полагаю, что этот ответ - предел того, что вы можете для него сделать. Я не знаю, почему мой вопрос принял -1, хотя ... NobleUplift 10 лет назад 0
Как это решит проблему. Это просто учебник по настройке x поверх ssh. user568109 10 лет назад 0
@ user568109 Если вы следуете этим указаниям и затем пытаетесь вызвать любую программу на основе графического интерфейса, она будет отображаться локально. Kruug 10 лет назад 0
`ForwardX11Trusted` - настройка на стороне клиента. Помещение этого в `sshd_config` в лучшем случае не будет иметь никакого эффекта и предотвратит запуск сервера SSH в худшем случае. -1. Это `sshd_config` против` ssh_config`, если вы ищете страницы `man`. 0xC0000022L 9 лет назад 6
"неправильный протокол аутентификации ..." возникает, когда вы `sudo`'ing. Пользовательские кредиты разные. Вы можете обойти это, отправив некоторую информацию из вашей учетной записи пользователя в xauth add ... `su - YOURUSERNAME -c 'xauth list' | grep `echo $ DISPLAY | cut -d ':' -f 2 | cut -d '.' -f 1 | sed -es / ^ /: / `| xargs -n 3 xauth add` Basic 8 лет назад 0
0

You can

xauth list 

then

xauth add <your display> 
Командная строка `xauth add dpyname protoname hexkey`. NobleUplift 10 лет назад 2
как ни странно, это не сработало с моими перенаправленными соединениями. sibaz 8 лет назад 0

Похожие вопросы