wiki:TipAndDoc/Windows/Cygwin

Version 2 (modified by mitty, 8 years ago) (diff)

--

Cygwin/X

  • Installing Cygwin/X
    • xorg-server (required, the Cygwin/X X Server)
    • xinit (required, scripts for starting the X server: xinit, startx, startwin (and a shortcut on the Start Menu to run it), startxdmcp.bat )
    • xorg-docs (optional, man pages)
    • X-start-menu-icons (optional, adds icons for X Clients to the Start menu)

X11 forwarding with PuTTY

  • 以下の手順はセキュリティを弱めることで問題に対応しているので、内容を理解して行うこと
    • Forwarding X11 using ssh on modern desktop

      localのXサーバの -nolisten tcp オプションを外す (snip) local機の 6000番ポートにつなげられる人がちょっかい出せるようになるので、 おすすめされていない。 (xauthが有効な限りDoS以外の害はなさそうだが)

Could not connect: Connection refused

  • $ virt-manager
     PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
    Unable to init server: Could not connect: Connection refused
    
    • $ echo $DISPLAY
      localhost:10.0
      
    • $ sudo netstat -nap | grep 6010
      tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      6568/sshd: mitty@pt
      tcp6       0      0 ::1:6010                :::*                    LISTEN      6568/sshd: mitty@pt
      
    • puttylog
      Event Log: Requesting X11 forwarding
      Event Log: Requesting OpenSSH-style agent forwarding
      Event Log: X11 forwarding enabled
      
      Event Log: Received X11 connect request from ::1:56944
      Event Log: Opened X11 forward channel
      Event Log: Forwarded X11 connection terminated due to local error: Network error: Connection refused
      
  • C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Cygwin-X\XWin Server.lnk
    C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; /usr/bin/startxwin"
    
    • startxwinをデフォルトのまま用いると、6000/tcpでListenしなくなる
      • D:\>netstat -nao | grep 7688
          TCP         127.0.0.1:53045        0.0.0.0:0              LISTENING       7688
        
      • D:\>netstat -nao | grep 6556
          TCP         127.0.0.1:53447        0.0.0.0:0              LISTENING       6556
        

Authorization required

  • $ virt-manager
    Authorization required, but no authorization protocol specified
    Unable to init server: Could not connect: Connection refused
    
  • Jon TURNEY - Re: Can't open display with PuTTY and xinit 1.3.4-1

    I'm afraid it seems '-listen tcp' is not enough for PuTTY to successfully connect. If the server was started with -auth (which startxwin does since xinit-1.3.4-1), then PuTTY will need authorization data to successfully connect. Whilst you can do this by setting the "X authority file for local display" in PuTTY's configuration to the Windows path equivalent to ~/.serverauth.NNNN, this isn't much of a solution as this filename changes everytime the server is started. Perhaps xinit needs an option to avoid using -auth? One can demonstrate that works by starting the server directly, e.g. using 'XWin -multiwindow -listen tcp' rather than 'startxwin'.

  • /usr/bin/startxwin (xint 1.3.4-9)
        xserverauthfile=$HOME/.serverauth.$$
    
  • startxwin -- -multiwindow -listen tcpで起動したときの /var/log/xwin/XWin.0.log
    XWin was started with the following command line:
    
    /usr/bin/XWin :0 -multiwindow -listen tcp -auth 
     /home/mitty/.serverauth.10152 
    
    • -authのパスが毎回変わるため、PuTTY側で指定するのが困難
  • 最終的に、XWin Server.lnkを以下のようにすることで解決
    C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; /usr/bin/XWin :0 -multiwindow -listen tcp"
    

Cygwin Ports

Attachments (1)

Download all attachments as: .zip