Reputation: 429
Note: X11 forwarding works fine if I use putty and X11 forwarding using localhost:0.0. I would like to get it to work using Windows 10 command line ssh. Here are my steps.
cmd
)ssh -X mymachine
and log in ok.export DISPLAY=localhost:0.0
xcalc
No protocol specified
Error: Can't open display: localhost:0.0
export DISPLAY=localhost:0.0
export DISPLAY=192.168.1.18:0.0
export DISPLAY=192.168.1.18:0
export DISPLAY=10:0.0
export DISPLAY=10:0.0.1
I even tried typing the following in the Windows command window:
set DISPLAY=localhost:0.0
ssh -X mymachine
but Windows didn't like that. I also tried using Windows Powershell. Nothing worked. I kept getting the same message.
Upvotes: 1
Views: 6903
Reputation: 11
This worked for me:
Local (Windows 10, Xming server)
Server (Raspberry Pi 4, RaspberryPi OS)
Ssh Client (Windows native ssh client)
Open windows command prompt and type set DISPLAY=localhost:0.0, then ssh -Y user@ip. Use -X for untrusted session. Works just fine.
Upvotes: 1
Reputation: 21
Xming Server:0.0 on Windows 10 computer with IP address 192.168.1.18
so the only way to connect to this X11-Server will be to
export DISPLAY=192.168.1.18:0.0
If there are still problems, check if you have enabled X11-forwarding in your putty client. You will find this under Putty Configuration > Connection > SSH > X11 Don't forget to save the Session after setting the X11-forwarding if you plan to use this setting more than one time. Session > Saved Sessions (put in name for your session) > Save
There is also the possiblity to run into a problem with the Xming Server. Right-click the Xming Server icon in the taskbar and view log. If there is a line "IP address not permitted" you will have to edit the file X0.hosts in the installation folder of Xming. Add the IP address of you Linux machine.
Upvotes: 1
Reputation: 429
I finally figured it out. I used Putty again and checked the $DISPLAY variable and got:
echo $DISPLAY
localhost:10.0
I just used the value 10.0 and it worked for both the cmd-shell and the Powershell.
But get this ... I tried the same thing the next day (after a restart on both machines) and it did not work.
I used ssh -X mymachine
and logged in
typed xcalc
and got the same error message.
(My $DISPLAY was set in my .bash_profile so I didn't need to reset it.)
I then tried Putty again, and it worked and $DISPLAY was set to localhost:10.0
I then returned to the open cmd-shell and typed xcalc
and it worked. I didn't do anything in that shell window prior. Here is the output
adrian@MyMachine:~$ xcalc
Error: Can't open display: localhost:10.0
adrian@MyMachine:~$ echo $DISPLAY
localhost:10.0
adrian@MyMachine:~$ xcalc
adrian@MyMachine:~$
It appears that Putty is doing something globally that has an effect on other shells without the need to reload. How is that so?
Upvotes: 3