Unable to get X display settings - linux

I have downloaded and installed Xming on my Windows 7 laptop. I am using a PUTTY session to connect to my linux box and start a X Windows application but the $DISPLAY variable is itself not getting setup properly:
I see the XMING icon on my system tray
X0.hosts file:
localhost
10.24.0.144
Putty->X11->Enable X11 Forwarding [X Display Location - :0.0]
But:
#10.24.0.144's password:
Last login: Sun Sep 20 11:57:37 2015 from 10.21.200.197
# echo $DISPLAY
#
As such I am not able to successfully start the X Windows app from Putty?

Did you check this box in PuTTY? The box below can help tweak your display location, if it needs to be customized.

On the shell try : export DISPLAY="127.0.0.1:10.0" . Test with echo and then try X window application.
To permanently set it up, update the bashrc file.

Related

Vinagre displays terminal of remote computer, how do I display the desktop instead?

I'm having problems displaying a remote desktop in vinagre, I'm using a Mint 20.3 computer to connect to a Debian 11 (xfce desktop) computer on my home network. I can get an ssh connection fine and access the machine by terminal, but I can't get a desktop interface through vinagre.
I start the server on the remote machine with tigervncserver -xstartup /usr/bin/xterm , then make an ssh connection on the local machine using ssh -L 5901:127.0.0.1:5901 remoteusername#ip. Then I use vinagre localhost:1, which brings up a password dialogue, pop in the password then I see a terminal in vinagre connected to the remote machine. Meanwhile, in the local terminal it prints loads of stuff, all prefixed with Gtk-WARNING, here's a sample:
(vinagre:7975): Gtk-WARNING **: 23:55:42.241: Theme parsing error: <data>:2:28: The style property GtkButton:default-border is deprecated and shouldn't be used anymore. It will be removed in a future version
(vinagre:7975): Gtk-WARNING **: 23:55:42.636: Drawing a gadget with negative dimensions. Did you forget to allocate a size? (node box owner ViewAutoDrawer)
My xstartup file reads:
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
I'm following the tutorial at this link and I'm stuck at step 4:
https://computingforgeeks.com/install-and-configure-tigervnc-vnc-server-on-debian/
I solved this by uninstalling tigervnc on the host and installing tightvnc instead. I then edited xstartup to read:
#!/bin/bash
xrdb $HOME/.Xresources
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
Then, ssh as before from the client:
ssh -L 5901:127.0.0.1:5901 remoteusername#ip
Start the vnc server on the host (with screen res specified):
vncserver -geometry 1280x1024
Finally start vinagre on the client:
vinagre localhost:1
Enter the password then done! Worked for me anyway, please comment if you have any solutions to get tigervnc going, I couldn't get it working properly.

WSL2 error: _tkinter.TclError: couldn't connect to display "127.0.0.1:0.0"

I have this error when run my python file: _tkinter.TclError: couldn't connect to display "127.0.0.1:0.0".
I mention that I am running VSCODE in WSL2 distro and Windows Pylance installed along with tkinter last version.
In my ZSH terminal I have added this line as it is recommended by Microsoft for WSL2: export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0. Commands like export DISPLAY=:0 doesn't work at all on WSL2.
Many thanks for any help,
vhij
LE: I have Windows 11 with Ubuntu 20.04 LTS distro, Xming and VcXsrv.
I have solved now after many trials and combinations, but it works now:
$ nano ~/.zshrc
Copied this 2 lines:
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
export LIBGL_ALWAYS_INDIRECT=1
$ source ~/.zshrc
Then in Windows: open XLaunch: Multiple windows -> Start no client -> Check 'Disable access control' -> Finish.
After that, I went on Windows Defender Firewall with Advanced Security and made 'green' status to all of VcXsrv and Xming X Server in Inbound Rules: Properties -> Allow the connection -> OK. (I have tried to add in Scope -> Remote IP address -> These IP addressess -> 172.72.0.1, but it didn't worked).
Then I run the python script successfully and tkinter window pop-up.

Configure Xming display on WSL2

I'm trying to configure an Xming display on my WSL2, and after an amount of troubleshooting attempts, I'm quite clueless.
For details:
System: WSL2 on Windows10Pro
Xming: installed. Some hopefully relevant lines from log:
Xming :0 -multiwindow -clipboard
XdmcpRegisterConnection: newAddress 172.27.16.1
Could not init font path element C:\Program Files (x86)\Xming/fonts/100dpi/, removing from list! (there are a few of these)
winInitMultiWindowWM - DISPLAY=127.0.0.1:0.0
winInitMultiWindowWM - XOpenDisplay () returned and successfully opened the display.
winMultiWindowXMsgProc - XOpenDisplay () returned and successfully opened the display.
winClipboardProc - XOpenDisplay () returned and successfully opened the display.
Firewall:
What I've tried: (on WSL2 terminal)
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
export LIBGL_ALWAYS_INDIRECT=1
As shown here
export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0
As shown ni subsequent link here
export DISPLAY=172.27.16.1 (/:0/:0.0)
as taken from the Xming log.
Results so far: in all cases I get
No protocol specified
Error: Can't open display: 172.27.16.1:0
or alike
Any advice?
Finally, a friend found a solution that worked for me.
In short:
use putty to open a WSL terminal and export DISPLAY variable as WORKSTATION_IP:0.0
in Xlaunch, check the "No Access Control" box.
I've put this as instructions in layman's terms in this short doc
I had success using
export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0
with Xming allowed through the Windows firewall for both private and public networks as you did (note for other users there are a couple of entries in the firewall settings for Xming). I then launched Xming using "Xlaunch" (Start > Xming > Xlaunch), selected Multiple Windows and then checked "No Access Control" on the "Specify Parameter Settings" screen. This last step appears to be the key one I was missing. Launching Xming.exe with the -ac option should achieve the same effect.
Add the IP address in the X0.hosts file (find it in the Xming installation directory). This file defines which hosts it will allow connections from.
Other option is to use the -ac option, however this will disable all access control restrictions...
U can use VcxSrv
xLaunch
use this settings
In my my case, I had to add XLaunch.exe to the Windows Firewall exceptions. I had Xming.exe added to the firewall when I installed it but not Xlaunch.exe.
To test quickly, just turn-off windows firewall then try running any linux gui app. Of course, you gotta do the export Display command first.

putty + xming: cannot connect to Xserver in Windows 7

I am trying to use putty and XMing to run programs from my Fedora 20. I used this configuration before on other machines and I was able to run GUI programs on Linux and display them in my windows 7. But this time I have trouble and get the "cannot connect to X server" error when I try to launch kwrite and kdesvn which are GUI programs in Fedora 20. The connections were good. And the XMing server was running and the X11 forwarding was enabled in putty, like the instruction here.
From my another Fedora 20 machine, I was able to connect to and run GUI programs from the target machine with ssh -X and the same username. So I am thinking the settings of the target machine was right.
Then what else I can try? how to figure out where the problem is?
Ensure that X11 forwarding is enabled in /etc/sshd_config.
X11Forwarding yes
Ensure in your home directory that you have an .Xauthority file. Permissions should be set 0600. If the file does not exist create it.
touch ~/.Xauthority
chmod 0600 ~/.Xauthority
As was previous stated first make sure that X11 forwarding is enabled in PuTTY.
Config > Connection > SSH > X11 > Enable X11 Forwarding. Based on your question it appears you already did this. Make sure you save this config.
I had a problem much like this, what happened to me was that my DISPLAY was being set elsewhere. If you can, try opening a new settion via putty from the same Windows machine using another user and then checking the display and testing your GUI programs
Another thing would be to use your own user but remove any custom work you may have done in your configuration, login fresh, check the DISPLAY and then test X
Did you enable X11 in putty?
It's under SSH | X11 | Enable X11 Forwarding
Then save the putty profile and click on session | save | open
Should work perfectly after you make those changes.

Cygwin home directory on target system inconsistent

I am having difficulty connecting to a remote Windows system running cygwin.
When I connect from a linux box to cygwin, it connects fine and "sees" the
remote home directory as /home/userID
When I connect from Windows cygwin to the remote windows cygwin, it sees
the home directory as /cygdrive/c/Documents and Settings/UserID
Finally, when I am logged onto the remote Windows machine (the one with the problem)
home is /home/UseID but the value for cygpath -H is
$ echo $(cygpath -H)
/cygdrive/c/Documents and Settings
This seems to be causing my connection problem from windows to windows
and no problem from linux to windows
Any ideas how to fix it?
Since you have the correct path in /etc/passwd, one possibility is that perhaps the SSH client you are using from your Windows systems is sending custom environment values.
If you're using PuTTY, before connecting, look in the tree panel on the left hand side of the dialog. There should be an entry called Connection and a sub-entry called Data which will bring you to an option screen that has a section called Environment variables. Check if the HOME var is being overridden there and if so, remove it.
If you're using a different SSH client, check its configuration to see if its using the SendEnv option. More info on that here: http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config.
Or you could try blocking off custom environments on the destination/server side by disabling AcceptEnv in the SSHd configuration on the system you're connecting to. More info on that here: http://www.openbsd.org/cgi-bin/man.cgi?query=sshd_config.
Hope this helps.

Resources