X11 Forwarding

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

X11 Forwarding

Postby Axolotl9250 » Fri Dec 28, 2012 11:51 pm

Hi I've been reading this post:

http://raspberry-python.blogspot.co.uk/2012/09/sidekick.html

I'm under the impression this will eliminate the need for VNC if I connect to my pi via ssh on my mac or windows machine. It seems to have been done in debian however and I'm struggling to achieve it in Arch.

So far I've made sure the openssh daemon runs on bootup by enabling it with the systemctl command.
$this->bbcode_second_pass_code('', '# systemctl enable sshd.socket')
I've checked the wiki for opens and have made the following changes to the two configuration files:
$this->bbcode_second_pass_quote('', '
')In /etc/ssh/sshd_config
#AllowTcpForwarding yes
#X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes

In /etc/ssh/ssh_config
#ForwardX11 yes


I've rebooted my Pi and on my mac terminal:
$this->bbcode_second_pass_code('', 'ssh -X ben@PI_IP_ADDRESS')
However if I then, from my session, start a graphical program such as midori, I get:
$this->bbcode_second_pass_quote('', 'M')idori - Cannot open display:

and if I startx on the ssh session, the desktop does indeed show up, not on my Mac as desired, but on a telly if I plug one into the HDMI slot.

I'm pretty confused, xhost + in the ssh session or in the terminal of a x session running on tty1 of my pi does not help things.

I'm not sure if I haven't completed all steps necessary to correctly configure this, I don't have any complicated DM, only open box, according to the author of the blog post (he also make a thread on the pi forums about doing this) it should work no problem with very little tweaking. I don't know if the problem is with my mac or the pi/arch setup. I know X11 on mountain lion has moved to something called the XQuartz project, I'm probably being dim - I suspect this needs installing first, but again, the instructions in the post and blog don't mention this as a requirement in the mac/linux/solaris section.

Thanks,
Ben.

[EDIT]
XQuartz is installed but starting up my ssh session I see "X11 forwarding request failed on channel 0"
Axolotl9250
 
Posts: 5
Joined: Sat Dec 22, 2012 9:12 pm

Re: X11 Forwarding

Postby karog » Sat Dec 29, 2012 12:40 am

On the Pi in /etc/ssh/sshd_config you need to uncomment X11Forwarding
$this->bbcode_second_pass_code('', '
#AllowTcpForwarding yes
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
')
by removing the # before X11Forwarding.

You don't need to do anything to /etc/ssh/ssh_config

Next from the Mac do
$this->bbcode_second_pass_code('', '
$ ssh -Y ben@PI_IP_ADDRESS

# pi> echo $DISPLAY
localhost:10.0
')
Note -Y rather than -X - see the man page.

Do the echo of $DISPLAY env var. It should be something like the above. If it shows nothing, something is not set up correctly.

Then in the ssh session run some program like xterm and you should get a window on the Mac.

You need to have XQuartz installed. It will start automatically when you run an X client program on the Pi but it is better to start XQuartz first so you don't wait wondering if there is a problem or simply waiting for X to start.
Last edited by karog on Sat Dec 29, 2012 6:52 am, edited 1 time in total.
karog
 
Posts: 305
Joined: Thu Jan 05, 2012 7:55 pm

Re: X11 Forwarding

Postby WarheadsSE » Sat Dec 29, 2012 3:28 am

Also of note: sshd is already enabled, by default, out of the box in Arch Linux ARM
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: X11 Forwarding

Postby Axolotl9250 » Sat Dec 29, 2012 4:18 pm

That's great, thanks, I notice
$this->bbcode_second_pass_code('', 'ssh -X ben@PI_IP_ADDRESS')
works as $this->bbcode_second_pass_code('', '$ ssh -Y ben@PI_IP_ADDRESS

# pi> echo $DISPLAY
localhost:10.0') does. Now I'm looking into getting it set up and running so as it is as secure as I can make it without gettin in way over my head. If both ways work, is one better or more secure than the other? I've already disabled root login, only use protocol 2 and have specified only my username on the pi can login by ssh. I'm currently looking at keys, which I think are used by unix based machines like linux/mac, I've not seen them set up on windows in my reading so far.

Thanks,
Ben.
Axolotl9250
 
Posts: 5
Joined: Sat Dec 22, 2012 9:12 pm

Re: X11 Forwarding

Postby harroxelas » Sat Dec 29, 2012 10:41 pm

PuTTY can do key auth on window$, but it doesn't support the usual OpenSSH key format, you'll have to convert it to PuTTY's format with PuTTYgen. As for X11 forwarding under window$, I think you'll need something like Exceed to make it work.
harroxelas
 
Posts: 13
Joined: Thu Nov 15, 2012 4:04 pm


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 58 guests