X11 Forwarding with SSH

This is fairly simple stuff but it took me 15 minutes to solve because i was missing a package :( So i thought i would write a quick article here we go X11 forwarding with ssh. This should work on any Linux distribution unless ssh has been built without the support for X forwarding. Which as far as i know is uncommon.

1. Install xauth with your package manager for ubuntu/debian do

aptitude install xauth

2. Edit the sshd_config on the server you want to start the X program from

vi /etc/ssh/sshd_config

3. Add the following to your sshd_config file on the server

X11Forwarding yes

4. Restart the ssh server

/etc/init.d/ssh restart

5. Edit the ssh_config on the client (this could also be in your home directory under .ssh/config)

vi /etc/ssh/ssh_config

6. Add the following to your ssh_config file on the client

ForwardX11 yes

7. Connect to the server with ssh

ssh user@host

8. You can also use ssh -X user@host Which switches on X Forwarding for the single connection. We don’t need this option because we set it permanently in the ssh_config on the client.

One thought on “X11 Forwarding with SSH

  1. Shrider

    Very great written Post, im learning english at this time and i come back very often to your blog, very helpfull the most time.
    regards from the uk

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>