Linux.com

Home Linux Community Community Blogs Desktops Forwarding X11 Apps through SSH

Forwarding X11 Apps through SSH

This quick post illustrates you how to forward remote X11 applications from another machine (called "server" in my example) to local Linux machine (or XWindow server on Windoze machine).

When you're in an insecure network just avoid to use X11 apps, but if you wish to get something else from remote you can do it with SSH, here's a quick example:

your computer name: "client"
other remote host: "server"

Remote username: "ben"
Application to run: "xterm"

 

Here's a quick and dirty hack for it, no DISPLAY settings or strange things, just one setup.

 

First setup remote host to allow X11 Port forwarding:

edit /etc/ssh/sshd_config to enable X11Forwading, change or add a line like this:
X11Forwarding yes
Then to make a test try to:
server ~$ cat /etc/ssh/sshd_config |grep X11Forwarding
X11Forwarding yes
If this is the result you've it enabled, note there's no "#" at the beginning of the line

 

Then connect to remote machine using ssh:

~$ ssh -X -Y ben@server
Please note -X -Y flags for ssh (port forwarding, see man ssh)

 

Now start your favorite X11 program (xterm in my example)

server ~$ xterm &
[1] 7448

And you're set ! Easy isn't it ?

 

 

Hope it helps

Andrea Benini (Ben )

 

Comments

Subscribe to Comments Feed

Upcoming Linux Foundation Courses

  1. LFD320 Linux Kernel Internals and Debugging
    03 Nov » 07 Nov - Virtual
    Details
  2. LFS416 Linux Security
    03 Nov » 06 Nov - Virtual
    Details
  3. LFS426 Linux Performance Tuning
    10 Nov » 13 Nov - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board