# Run X apps remotely on another FreeBSD box



## Doug (Jan 21, 2011)

Hello and thanks in advance for any help.

Remote X Applications

I would like to run the kmail appliation on the desktop machine from my laptop.

From what I have read in the posts there seems to be two ways to do it. 
Over ssh and another way using xhosts and Display settings. 

I have managed to get the ssh method working for a test using xcalc but I cannot run Firefox or kmail which are the applications I really want. So I would like to persue the non ssh method. I realise the example below is not very secure but I will tighten it up once I can get it working.

If I run the command "kmail" in an xterm on the desktop machine kmail starts OK. But I cannot seem to get it to diaplay remotely on the laptop.

Two machines  - 
Desktop 10.1.1.1 
FreeBSD 8.1-RELEASE
KDE4 running with 6 desktop windows
X.Org X Server 1.7.5

Laptop 10.1.1.77
FreeBSD 7.3
KDE 4 running with 4 desktop windows
X.Org X Server 1.6.0

On Laptop (10.1.1.77) I issue the command
`$xhost +`
Very insecure I know.

Check it with
[cmd=]$ xhost[/cmd]
access control disabled, clients can connect from any host

On Desktop I issue the commands:
`$export DISPLAY=10.1.1.77:0.0`
(using /bin/sh)

Check it with:

```
$ set | grep DISP
DISPLAY=10.1.1.77:0:0
$ xcalc &
$ Error: Can't open display: 10.1.1.77:0:0
```



```
ps waux | grep X
root        1572  0.4 18.2 392940 376604  ??  S    10:03AM  15:20.44 /usr/local/bin/X -br -quiet -nolisten tcp :0 -auth /0
```

I have seen a lot of comments on posts about the nolisten option setting on X but I have not found any way to disable it or confirmed it is an issue with the software versions I am running. It exists in /usr/local/kde4/share/config/kdm/kdmrc

```
ServerArgsLocal=-nolisten tcp
```
 but the file seems to get rewritten each reboot.

Thanks in advance


----------



## SirDice (Jan 21, 2011)

You need to have an X server on your laptop for the application to connect to. For added security stick to the ssh method. Post the problems you are having with that.

The *nolisten* flag on X is for XDMCP. XDMCP is similar to Terminal Services on Windows. A different way of working remote.


----------



## Doug (Jan 21, 2011)

Howdy - thanks

I thought I would have had a X server running as I am running KDE desktop on the laptop which I thought would need an X server to run. (I may be wrong).

I am not too concerned with security as the devices are not on the internet yet and I am just saving some work walking up stairs while I configure all the apps to swap machines over.

From the 10.1.1.77 machine
When I try firefox3 it starts but it runs the one on 10.1.1.77
There is no mozilla or firefox processes running on 10.1.1.1 ?
`ssh -X [email=fred@10.1.1.1]fred@10.1.1.1[/email]  /usr/local/bin/firefox3`



From the 10.1.1.77

```
ssh -X fred@10.1.1.1  /usr/local/kde4/bin/kmail
Password:veryverysecret
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
kmail(74464) KLocalePrivate::initEncoding: Cannot resolve system encoding, defaulting to ISO 8859-1. 
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
"/usr/local/kde4/bin/kmail(74464)" Error in thread 763367744 : "org.freedesktop.DBus.Error.ServiceUnknown - The name 
org.kde.nepomuk.services.nepomukstorage was not provided by any .service files"
"/usr/local/kde4/bin/kmail(74464)" Error in thread 763367744 : "QLocalSocket::connectToServer: Invalid name"
"/usr/local/kde4/bin/kmail(74464)" Error in thread 763367744 : "org.freedesktop.DBus.Error.ServiceUnknown - The name 
org.kde.nepomuk.services.nepomukstorage was not provided by any .service files"
"/usr/local/kde4/bin/kmail(74464)" Error in thread 763367744 : "QLocalSocket::connectToServer: Invalid name"
"/usr/local/kde4/bin/kmail(74464)" Error in thread 763367744 : "org.freedesktop.DBus.Error.ServiceUnknown - The name 
org.kde.nepomuk.services.nepomukstorage was not provided by any .service files"
"/usr/local/kde4/bin/kmail(74464)" Error in thread 763367744 : "QLocalSocket::connectToServer: Invalid name"
kdeinit4: preparing to launch /usr/local/kde4/lib/libkdeinit4_klauncher.so
klauncher(74469) KLocalePrivate::initEncoding: Cannot resolve system encoding, defaulting to ISO 8859-1. 
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kdeinit4: preparing to launch /usr/local/kde4/lib/libkdeinit4_kded4.so
kded(74472) KLocalePrivate::initEncoding: Cannot resolve system encoding, defaulting to ISO 8859-1. 
kdeinit4: preparing to launch /usr/local/kde4/lib/libkdeinit4_kbuildsycoca4.so
kbuildsycoca4(74475) KLocalePrivate::initEncoding: Cannot resolve system encoding, defaulting to ISO 8859-1. 
kbuildsycoca4 running...
kdeinit4: preparing to launch /usr/local/kde4/lib/libkdeinit4_kconf_update.so
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kmail(74464)/libakonadi Akonadi::ServerManager::start: Unable to execute akonadi_control, falling back to D-Bus auto-launch 
kmail(74464) main: Unable to start Akonadi server, exit application 
kmail(74464)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
<unknown program name>(74457)/: Communication problem with  "kmail" , it probably crashed. 
Error message was:  "org.freedesktop.DBus.Error.ServiceUnknown" : " "The name org.kde.kmail was not provided by any .service files" "
```

or to start it with a hint I found on the internet.


```
ssh -X fred@10.1.1.1  'dbus-launch /usr/local/kde4/bin/kmail'
Password:
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
kmail(74492) KLocalePrivate::initEncoding: Cannot resolve system encoding, defaulting to ISO 8859-1. 
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
"/usr/local/kde4/bin/kmail(74492)" Error in thread 763367744 : "org.freedesktop.DBus.Error.ServiceUnknown - The name 
org.kde.nepomuk.services.nepomukstorage was not provided by any .service files"
"/usr/local/kde4/bin/kmail(74492)" Error in thread 763367744 : "QLocalSocket::connectToServer: Invalid name"
"/usr/local/kde4/bin/kmail(74492)" Error in thread 763367744 : "org.freedesktop.DBus.Error.ServiceUnknown - The name 
org.kde.nepomuk.services.nepomukstorage was not provided by any .service files"
"/usr/local/kde4/bin/kmail(74492)" Error in thread 763367744 : "QLocalSocket::connectToServer: Invalid name"
"/usr/local/kde4/bin/kmail(74492)" Error in thread 763367744 : "org.freedesktop.DBus.Error.ServiceUnknown - The name 
org.kde.nepomuk.services.nepomukstorage was not provided by any .service files"
"/usr/local/kde4/bin/kmail(74492)" Error in thread 763367744 : "QLocalSocket::connectToServer: Invalid name"
kdeinit4: preparing to launch /usr/local/kde4/lib/libkdeinit4_klauncher.so
klauncher(74495) KLocalePrivate::initEncoding: Cannot resolve system encoding, defaulting to ISO 8859-1. 
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kdeinit4: preparing to launch /usr/local/kde4/lib/libkdeinit4_kded4.so
kded(74497) KLocalePrivate::initEncoding: Cannot resolve system encoding, defaulting to ISO 8859-1. 
kdeinit4: preparing to launch /usr/local/kde4/lib/libkdeinit4_kbuildsycoca4.so
kbuildsycoca4(74498) KLocalePrivate::initEncoding: Cannot resolve system encoding, defaulting to ISO 8859-1. 
kbuildsycoca4 running...
kdeinit4: preparing to launch /usr/local/kde4/lib/libkdeinit4_kconf_update.so
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kmail(74492)/libakonadi Akonadi::ServerManager::start: Unable to execute akonadi_control, falling back to D-Bus auto-launch 
kmail(74492) main: Unable to start Akonadi server, exit application 
kmail(74492)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
<unknown program name>(74486)/: Communication problem with  "kmail" , it probably crashed. 
Error message was:  "org.freedesktop.DBus.Error.ServiceUnknown" : " "The name org.kde.kmail was not provided by any .service files" "
```


----------



## SirDice (Jan 21, 2011)

Try starting a "simple" program like xterm first. When that works move on to the other things. The errors indicate a few other issues but we need to make sure the X forwarding at least works.


----------



## Doug (Jan 21, 2011)

Howdy

Yep I have managed to get xcalc up and running using the ssh method but not the xhost method.

Using ssh method I run theis command on 10.1.1.77 laptop
`ssh [email=fred@10.1.1.1]fred@10.1.1.1[/email] xcalc`

Xcalc starts and I can telnet to the 10.1.1.1 desktop and to a ps command to confirm xcalc is running there but displaying on 10.1.1.77

To try and use the other method - which is the prefered method and it may circumvent all the other errors I experience with the ssh method as I know the apps run locally and I just want them to display on the other machine.

On the 10.1.1.1 desktop

```
$ xcalc &
$ Error: Can't open display: 10.1.1.77:0:0
```


----------

