# How to remote connect to an X server

## opensas

Sorry for this newbie question

I have a gentoo box running X (with KDE)

I want to connect to a debian server in my network which is running X with debian

I've got the ip address and a valid account and password

So, which is the client program to log onto the debian X server???

Saludos

Sas

----------

## Randy R

check out:

http://www.nomachine.com/

----------

## anxt

well you could ssh in (to debian box) and 

```
export DISPLAY=192.168.1.1:0

mozilla &
```

on the server side (well the machine you want to see x on, actually the server in x), first run:

```
xhost +
```

i use xdm as display manager, merely startx won't cause it to listen by default, i never bothered look into why.

tightvnc is very cool too.  if it is a local 100mb or something, exporting X sessions is as if it is local.

----------

## zmedico

I hear NX is very nice.  I haven't used it but I know there are nxclient and nxserver-freenx ebuilds that I would like to try.

The tightvnc client and server work well.  You can also use x11vnc to remote control a normal X session.

----------

## opensas

Thank you all

I'm a little confused

I thought that X11 was inherently net enabled. So I guess that all the products you've been recommending me are just improvements to X11

First of all I'd like to learn how to set a linux box an X11 server, in order to access it from a windows client (there's an opensource source win32 X11 client based on Cygwin, I think)

Then I'll have a look at some other tools. (Well, in fact right now I'm downloading tightvnc)

As soon as i get home, I'll try anxt advice.

If anybody can tell me where to fin a nice HowTo I'll be glad

Saludos

Sas

PS The whole reasen behind this post, is that I'mm trying to propose at my work a replacement for Micro$oft Terminal Server.  :Wink: Last edited by opensas on Sat May 21, 2005 7:27 pm; edited 1 time in total

----------

## zmedico

 *opensas wrote:*   

> I thought that X11 was inherently net enabled. So I guess that all the products you've been recommending me are just improvements to X11

 

The main issues with plain X protocol are bandwidth and security.  NX solves both issues.  VNC can tunnel through ssh for security (what NX does).

 *opensas wrote:*   

> First of all I'd like to learn how to set a linux box an X11 server, in order to access it from a windows client (there's an opensource source win32 X11 client based on Cygwin, I think)

 

You can set up xdm (or kdm or gdm) on the Linux server and connect to it with cygwin X but it is insecure and high bandwidth.  Go ahead and try it for kicks but in the end you will probably want to use NX or VNC.

----------

## opensas

Well, that clarifies a bit the whole thing

I've been surfing around, and I think that nx is commercial, while tightvnc is free (am I wrong)

I've also found the following links

http://linuxreviews.org/howtos/xvnc/

http://gentoo-wiki.com/HOWTO_Xvnc_terminal_server

http://gentoo-wiki.com/HOWTO_Use_TightVNC_W/_JPEG_Compression_to_connect_to_existing_X_Sessions

and

http://www.buanzo.com.ar/lin/x_cliente_servidor.html (in spanish)

I'll give them a try and then I'll tell you

Thanks

Saludos

Sas

PS: I couldn't find (haven't benn looking hard) a tutorial for X, so I guess everybody agrees with you and wouldn't use plain X11 remotely

----------

## zmedico

 *opensas wrote:*   

> I've been surfing around, and I think that nx is commercial, while tightvnc is free (am I wrong)

 

You are correct but nomachine has GPL'd parts of NX so you can use nxclient and nxserver-freenx ebuilds without actually paying anything (nxserver-freenx is all GPL but the nxclient is not).

If you need security for VNC just google for vnc ssh tunnel.  I have found that the blowfish encryption performs well.

----------

## opensas

Hi

I began playing around with x11 (while nx sources are being downloaded) but I stumbled with the following error

I did as anxt told me, and followed the instructions faound at http://www.buanzo.com.ar/lin/x_cliente_servidor.html

Here's a small account

```

   1. Iniciar XWindow por el metodo elegido (X o startx).

   2. Obtener nuestra direccion IP utilizando ifconfig. Este sera el valor que usaremos para la variable DISPLAY en el sistema remoto.

   3. desde un shell (sea de otra consola, o desde una xterm en el XWindow recien cargado) conectarnos por ssh, telnet o el metodo que sea a otro sistema GNU/Linux o U*nix, tambien, ya que el protocolo X es comun a todos.

   4. Obtener la IP del sistema remoto (otra vez ifconfig).

   5. Localmente, habilitar dicha IP con xhost +IP.

   6. Remotamente, ejecutar "export DISPLAY=ip_nuestra:0". ip_nuestra es el valor obtenido en el paso (2).

   7. Ultimo paso, ejecutar el cliente X en cuestion, claro esta desde el sistema remoto.

```

So I have two machines, tux & larry

```

tux root # ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:8C:4C:88

          inet addr:192.168.67.128  Bcast:192.168.67.255  Mask:255.255.255.0

...

tux root # ssh larry

Password:

Last login: Mon May 23 23:48:49 2005 from 192.168.67.128

larry root # ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:B0:F7:AE

          inet addr:192.168.67.132  Bcast:192.168.67.255  Mask:255.255.255.0

```

I execute 

```

tux root # xhost +

access control disabled, clients can connect from any host

```

and then at larry

```

larry root # export DISPLAY=192.168.67.128:0

```

If, at larry, I execute "startx", I get the ugly twm window manager

If I try with "X", I get the gray screen

If I try with twm I get

twm:  unable to open display: "192.168.67.128:0"

and the same if I try with

```

twm .display 192.168.67.128:0

```

Also tried with "xcalc" and I got

Error: Can't open display 192.168.67.128:0

Am I missing something???

This is my kernel and xorg version

```

tux root # uname -a

Linux tux 2.6.11-gentoo-r8 #1 Sun May 15 20:32:34 ART 2005 i686 AMD Athlon(tm) XP 2600+ AuthenticAMD GNU/Linux

tux root # eix xorg-x11

* x11-base/xorg-x11

     Available versions:  6.8.2-r1 [M]6.8.2-r2 [M]6.8.99.3 [M]6.8.99.5

     Installed:           6.8.2-r1

```

And I've installed kde 3.4

Saludos

Sas

PS: I hope I have more luck with nx[/code]

----------

## zmedico

 *opensas wrote:*   

> 
> 
> ```
> 
> tux root # xhost +
> ...

 

Why startx?  I thought an X server was already running on tux (that's why you ran xhost +).

 *Quote:*   

> Also tried with "xcalc" and I got
> 
> Error: Can't open display 192.168.67.128:0
> 
> Am I missing something???

 

Are you sure that the X server on tux is configured to listen on TCP/IP? It is disabled by default.  If you use startx then edit that and remove "-nolisten tcp" from the X server arguments.  You may want to look at the man pages for startx and Xserver.

```
tux root # which startx

/usr/bin/startx
```

After you edit that file restart X and try again.  You can use "netstat -tap" on tux to see what is listening.  Also check if you have iptables rules (client or server) that would block the connection.  If you still have problems the check /var/log for clues.

----------

## opensas

Thanks zmedico, I found out I had it all mixed up. I haven't quite understood what I was doing

Let me see if now I get it straight

tux (192.168.67.128) has xorg-x11 6.8.2-r1 and kde 3.4, and is going to be my X server

larry (192.168.67.132) has nothing but xorg-x11 6.8.2-r1 and is going to be my x client

so I startup tux and run startx to enter kde

then I startup larry and issue startx to start twm (I think that's the name of that loathsome windows manager that comes by default with xorg)

at an xterm in larry in twm, i do the following

```

bash-2.0b# xhost +

access control disabled, client can connect from any host

```

With this I allowed every machine knowing my ip and running x11 to write to my display... right?

then I do the following (after updating /etc/hosts with tux ip address)

```

bash-2.0b# ssh tux

Password:

tux root # export DISPLAY=192.168.132:0

```

With this I tell the X server running at tux to redirect every output from this session to the first screen at larry

then i issue

```

tux root # konqueror &

```

and after quite some time i get

```

tux root # konqueror: cannot connect to X server 192.168.167.132:0

```

Likewhise, if I leave larry and go to tux, open a konsole and run xcalc I get

```

tux root # export DISPLAY=192.168.132:0

tux root # xcalc

Error: Can't open display: 192.168.67.132:0

```

Well, I don't know what could be happening

But anyway this is not what I had in mind

Once I connected from an Xp worsktation running cygwin to a remote debian with gnome, just like a remote server. It poped up shm (I think it's called like that) asking for my user and passwd and then I entered into gnome. I was trying to do something like that, not just running one app remotely.

I was looking for something more like MS Terminal server, so I emerge nxserver-freenx at tux, and nxclient at larry

at tux did

```

tux root # useradd guest

tux root # passwd guest

tux root # /etc/init.d/sshd start

tux root # /usr/NX/bin/nxserver --start

```

at larry

bash-2.05b# nxclient

login: guest

password:

session: tux

If I press the configure button

Server

Host:tux

Port:22

Desktop

Unix - KDE

(there's also a VNC option... what's that???)

Optimized for LAN

Everything else was left as it came by default

When connecting I see tht following messages

Connecting to tux

connected

Authentication completed

Negotiating link parameters

Could not yet establish the connection to the remote proxy. Do you wan to terminate the current session?

It seems it just dies negotiating link parameters...

Then I choose to abandon connection, and in the details I see the following

```

NXPROXY - Version 1.4.0

Copyright (C) 2001, 2004 NoMachine.

See http://www.nomachine.com/ for more information.

Info: Proxy running in client mode with pid '3100'.

Info: Connecting to remote host '192.168.67.128:5000'.

Info: Aborting procedure due to signal '15'.

```

I also tried from an XP running NX Client for Windows and I get the same error

Am I mising something??

Do I have to give some special permission to guest?

---

Hey, I've been searching around, and I've found the following in /usr/Nx/bin/nxserver

```

# Free implementation of nxserver components

#

# To use nxserver add the user "nx" 

# and use nxserver as default shell.

#

# Also make sure that hostkey based authentification works.

```

I've checked the nx user

tux root # cat /etc/passwd | grep nx

nx:x:101:100:added by portage for nxserver-freenx:/usr/NX/home/nx:/usr/NX/bin

But I don't know what is the hostkey based authentication

BTW where is the nxserver documentation??? "grepfind /usr/share/doc nxserver" gives me no clue

---

Kept trying other things like

```

tux portage # usermod -G root,wheel,adm guest  

```

Now I get the following from the client when trying to connect

NX client was not able to establish an unencrypted channel with the server. This could be due to the remote server being behind a firewall. If this is the case, you should be able to run your session by selecting the option "Enable SSL encryption of all traffic" in the configuration dialog.

I did so, and now I get

```

NXPROXY - Version 1.4.0

Copyright (C) 2001, 2004 NoMachine.

See http://www.nomachine.com/ for more information.

Info: Proxy running in client mode with pid '2332'.

Info: Waiting for connection from any host on port '2006'.

Info: Accepted connection from '127.0.0.1' on port '2088'.

Info: Connection with remote proxy established.

Error: Remote NX proxy closed the connection.

Error: Please check your authorization credentials.

```

BTW, I have no network at home, I only have one machine. So I'm trying all this stuff on an XP SP2 host running larry and tux inside vmware. They can ping and ssh each other with no problem.

When I first tryed the Windows client from the host, an annoying XP SP2 dialog warned me about an application tryng to do some nasty thing an asking me to block it, I told it to unblock. Maybe that's what's been bothering around...

Well, I think I'm pretty close to it. I'll have a look at nomachine's site...

If anybody can help with this nx stuff and the remote x I'll be grateful.

Saludos

Sas

z[/code]medico: I'm about to try what you told me, I'll tell you back later. Thanks

----------

## opensas

Hi zmedico

I finally got the remote X11 working  :Laughing: 

I just removed the "-nolisten tcp" from the startx at larry, like you told me, and it all went fine.

It's funny to see Kde's konqueror with all its eyeconday stuff running over the twm window manager

Well, now I'll move onto tn NX stuff  :Wink: 

Saludos

SasLast edited by opensas on Thu May 26, 2005 5:47 am; edited 1 time in total

----------

## opensas

I could solve the NX stuff.

I just had to update /etc/shadow, replacing the "!" in "nx:!:"? with "*", to let nx login remotely 

Obviously, I found out about it on these forums  :Laughing: 

Saludos

Sas

----------

## zmedico

I'm using nxserver-freenx-0.4.0 which blocks nxclient unless I add USE=commercial.

 *Quote:*   

> NX> 203 NXSSH running with pid: 8406
> 
> NX> 285 Enabling skip of SSH config files
> 
> NX> 200 Connected to address: 192.168.0.254 on port: 22
> ...

 

When I first tried nxclient I got the above error.  After some searching I found out about the nxsetup command that comes with freenx.

```
nxsetup --install --setup-nomachine-key
```

After running nxsetup on the server (and sshd) I was able to connect with no problems.  It seems to work very well  :Very Happy: 

----------

## opensas

I saw the --setup-nomachine-key param in one thread I visited, but I had no need of it.

It all went fine, In the windows client I have the key stored at

C:\Archivos de programa\NX Client for Windows\share\client.id_dsa.key

And at the linux client in

/usr/NX/share/client.id_dsa.key

It's working pretty fine.

Now I'll be struggling with win4lin and vmware, 'cause in fact I'm looking for something to replace Micro$oft Terminal Server  :Wink: 

If you know of any open source alternative to VmWare (plex86 is not very healthy nowdays) just let me know

Saludos

Sas

----------

## zmedico

 *opensas wrote:*   

> Now I'll be struggling with win4lin and vmware, 'cause in fact I'm looking for something to replace Micro$oft Terminal Server  

 

You need windows apps?  If you're using win4lin or vmware then you're still using windows.  You might as well use Terminal Server too.

 *opensas wrote:*   

> If you know of any open source alternative to VmWare (plex86 is not very healthy nowdays) just let me know

 

Qemu is open source and similar to vmware but the performance is not very good.  The qemu developer maintains a proprietary accelerator module but I haven't tried it.  Wine is the only other thing I can think of if you need windows apps.

It would be nicer you could just use linux apps  :Wink: 

----------

