# Forwarded X with SSH



## adamos42 (Sep 19, 2015)

I tryed start obs with X Forwarded SSH, but the result was this:

```
adamos42@a42book:~$ ssh -X 10.42.0.1
adamos42@10.42.0.1's password:
Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-28-generic x86_64)

* Documentation:  https://help.ubuntu.com/

You have mail.
Last login: Sat Sep 19 15:15:48 2015 from 10.42.0.109
adamos42@a42linux:~$ obs
X11 connection rejected because of wrong authentication.
QXcbConnection: Could not connect to display localhost:10.0
Félbeszakítva (core készült)
adamos42@a42linux:~$
```

It will be usefull if I can start obs on my laptop remoteley and with forwarded X the obs window will be on my laptop not on my pc (i can see the stream status, active scenes, sound levels)


----------



## zenobs (Sep 19, 2015)

Maybe using  -Y flag helps.

$ ssh -C -Y USER@10.42.0.1

Or read man page.


----------



## adamos42 (Sep 19, 2015)

zenobs said:


> Maybe using  -Y flag helps.
> 
> $ ssh -C -Y 10.42.0.1
> 
> Or read man page.



Result not changed:


```
adamos42@a42book:~$ ssh -C -Y 10.42.0.1
adamos42@10.42.0.1's password: 
Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-28-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

You have mail.
Last login: Sat Sep 19 23:03:35 2015 from 10.42.0.109
adamos42@a42linux:~$ obs
X11 connection rejected because of wrong authentication.
QXcbConnection: Could not connect to display localhost:10.0
Félbeszakítva (core készült)
```


----------



## zenobs (Sep 19, 2015)

Then edit edit /etc/ssh/sshd_config and enable X forwarding.


----------



## adamos42 (Sep 19, 2015)

```
X11Forwarding yes
```

I'd appreciate if you not handle me as a beginner, the idea came to my mind because I had used the Forwarded X before. It worked with other programs, so the problem should be in the obs.

Nevertheless, if you have a workaround, i will try it. Somehow the obs should detect the console start and get the localhost display device, it die because the localhost:10.0 can't open and it's not a permission problem.

I tryed to export $DISPLAY too but im not successed, now the whole X forward not working somehow :/ I will repear it soon. Removing the *.Xauthority* file does not help eather for the authentication problem.


----------



## zenobs (Sep 19, 2015)

0. First check xauthentication state between the two.
1. First check whether .Xauthority is owned by you and has proper permissions.
2. Check whether X11 forwarding is enabled in your ssh client



PS: I avoided the command lines as you must be aware of the above two.


----------



## adamos42 (Sep 20, 2015)

zenobs said:


> 1. First check whether .Xauthority is owned by you and has proper permissions.
> 2. Check whether X11 forwarding is enabled in your ssh client
> 
> PS: I avoided the command lines as you must be aware of the above two.



I did both of them, the 2. before starting the topic, 1. before posted the last post: #post-165990.
It works for you? Did you tried use obs with remote X before?


----------



## zenobs (Sep 20, 2015)

Yep. I just tried with two machines in my network just a while ago, fyi, and it works wonderfully.

Can you tell me exactly what you have done among the steps, including the commands? It would help the visitors here to understand exactly the problem and give relevant solutions.

PS. Over the forum, no one can assume the other, fyi.


----------



## adamos42 (Sep 20, 2015)

Okay then:

I have a PC with Ubuntu 15.04 where I use obs, this is my server (a42linux - 10.42.0.1). I have a laptop with Ubuntu 15.04 where I want to controll obs, this is my client (a42book - 10.42.0.109). The internet is plugged in on the a42linux ethernet and I make a hotspot with the internal TP-LINK wifi card for a42book.

First I installed full ssh on both machine:

```
sudo apt-get install -y ssh
```

Cheking the Forwarding on both machine:

```
grep X11Forwarding /etc/ssh/sshd_config
```

If the output is not:

```
X11Forwarding yes
```

then edit the file and enable the X11Forwarding

```
sudo echo "X11Forwarding yes" >> /etc/ssh/sshd_config
sudo service sshd restart
```

After that preparations I doed that:

```
adamos42@a42book:~$ ssh -X 10.42.0.1
adamos42@10.42.0.1's password: **********

[ssh connected]

adamos42@a42linux:~$ nautilus
```

Nautilus started without problem. I closed, after that I tried:

```
adamos42@a42linux:~$ obs
```

The result was:

```
X11 connection rejected because of wrong authentication.
QXcbConnection: Could not connect to display localhost:10.0
Félbeszakítva (core készült)
```

The "X11 connection rejected because of wrong authentication." and the "QXcbConnection: Could not connect to display localhost:10.0" is seperate problems I think, but maybe I not right.

I tried solve the "X11 connection rejected because of wrong authentication." problem:

```
adamos42@a42book:~$ sudo rm .Xauthority
adamos42@a42book:~$ touch .Xauthority
```


```
adamos42@a42linux:~$ sudo rm .Xauthority
adamos42@a42linux:~$ touch .Xauthority
```

I checked the permissions:

```
adamos42@a42linux:~$ ls -l .Xauthority 
-rw-rw-r-- 1 adamos42 adamos42 53 szept 20 09:07 .Xauthority
```

If I export DISPLAY on server then I can start programs on the server and it shows on the server monitor:

```
adamos42@a42linux:~$ export DISPLAY=:0.0
```

I think I just not get the right display for the task. I try use 10.42.0.109:0.0 as a display but not wokring. I added the client display to the xauth list, but still not working.


----------



## zenobs (Sep 21, 2015)

Meaning you have are yet to do everything. Do the following:

1. If you have not following two lines in your /etc/sshd/ssh_config (not sshd_config), append them.

Host *
ForwardX11 yes

Check if xauthentication works.



2. Else, do in your machine:

2A) Local machine:

$ xauth list $DISPLAY

You get something like:

machinename/unix:0  MIT-MAGIC-COOKIE-1  9184cm169759521c99d320c46057f6c7

2B) Remote machine

Add the cookies to the remote machine via ssh:
$ xauth add :0  MIT-MAGIC-COOKIE-1  9184cm169759521c99d320c46057f6c7

2B1) hen check if the machine name is not shown by:

$echo $DISPLAY

It should show you local machine name if that is authenticated.

Hope this helps.


----------

