InfectedProject

Forwarding GNOME via SSH

Jul 9th 2007
43 Comments
respond
trackback

Connect to your Linux computer remotely without needing to take the less secure VNC route yet, still having a GUI to work with. This quick and painless tutorial will show how to forward your GNOME session from your Linux box to another computer, via SSH and X11 Forwarding. I have found out along the way that X11 forwarding seems quicker then a traditional VNC connection and has better integration. Better security and (what seems like) quicker response times are just one of the benefits of using SSH. You will of course need a OS that has X11 and GNOME installed for this experiment. This tutorial can also be applied towards other desktop environments as-well such as KDE if you wish and for individual applications.

Requirements

  • Two computers
  • One Computer running X11
  • One Computer running X11 and GNOME
  • Static IPs set
  • General knowledge of Linux
  • About 20-30min Free time

Step One

Set-up SSH on the Linux server, on Ubuntu Linux type sudo apt-get install SSH in the terminal and press enter. Type your admin password in and SSH should now be successfully installed.

Step Two

X11 forwarding is turned off by default when SSH is installed on your Linux server, it is now your task to turn it on. Type sudo  gedit /etc/ssh/ssh_config into terminal and press enter. Add

ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes

to the file ssh_config and save it.

Repeat Step Two for the sshd_config file type sudo gedit /etc/ssh/sshd_config into the Linux terminal and press enter. Add

X11Forwarding yes

to the file sshd_config and save it.

Step Three

Connecting via SSH

Now from Mac OS X (any OS with x11 installed) type ssh -X username@server.ip.address into the X11 terminal (xterm) located inside the Utilities folder on Mac OS X. You will then be connected via SSH to the server.

Step Four

Typing Gnome-Session

After your connected to the server via SSH type gnome-session into the xterm terminal. It may take a second but you should see the start-up sequence for GNOME. Enjoy!


This post is tagged

43 Responses

  1. This is one of the web’s most interesting stories on Mon 14th Jan 2008

    These are the web’s most talked about URLs on Mon 14th Jan 2008. The current winner is ..

  2. Nice tip, thanks :)

    Problems are:
    - gnome menu bar and bottom bar are disappearing from the screen
    - double clicking on desktop files deosn’t seem to work
    - when opening in mac X11, the mouse is parasited (transformed to text pointer) by the X11 terminal windows

  3. Scott says:

    How about a tutorial on forwarding an X11 session to a Windows computer running cygwin?

  4. Ronny says:

    Great guide.
    “IPs”, not “IP’s”.

    If you drive “cars” and not “car’s”, fly in “airplanes” and not “airplane’s”, then you should be also:
    -Configuring PCs (not “PC’s”)
    -Listening to “CDs” (not “CD’s”)
    -Watching “DVDs” (not “DVD’s”)

    -Ronny

  5. Ronny says:

    There’s also the issue of “quicker then”…

    -Ronny

  6. Steven says:

    @Ronny - What are you, a f**king english teacher? It’s a technical guide, not a f**king spelling test.

  7. Andrew says:

    @Alexandre Girard

    I’ve only tested the instructions of this tutorial in 10.4 Tiger. Everything seemed to be working for me. Which version of OS X are you using and do you have the latest version of X11?

  8. James says:

    Scott: You should basically be able to follow the same set of instructions for Windows. Just make sure you have X11 installed in your cygwin install, and you have PuTTY (Google if necessary). Open the cygwin terminal. Type “startx” (no quotes). Then open PuTTY and make sure X11 Forwarding is enabled. That’s the gist of it.

  9. Brian says:

    Ronny iz a pees of shyte. There, suck on that you commie bastard.

    BTW, nice article!

  10. Abuse says:

    Comment abuse makes me smile. Ronny, you’re not making friends here!

  11. Abuse says:

    Bookmarked. Thanks for the article!!!

  12. Mike Miller says:

    Why not just use NoMachine? Much easier.

  13. B-Con says:

    Why would you want to overwrite your existing config files, though? Why not just use sudo/gksudo to run gedit as root and directly edit the existing config files? Or even back up the config files, add the necessary options, then overwrite the originals.

  14. Cory says:

    Thank you for the basic walk through. I agree with B-Con, I just back up the config files, then directly overwrite them in the correct directory. The way you did it added a lot of uneccessary steps and clutter in your writeup. Also I’m not using Gnome, I found that typing xfce4-session launches a xfce desktop. It might be handy for others if you’d note these other desktop options in your write up.

  15. Olev says:

    Oh, and one important thing. You do not need to have static IPs set. That is not a required to run X11 or SSH.

  16. Jorixine says:

    what about the menus desapearing?
    when i go throgh de bar menus they desapear and appear…
    it seems to have to sessions on the same desktop… could you start other x session directly?

  17. Jorixine says:

    so sorry for my horrible english in the last post…
    its too early for me here in Argentina

  18. Andrew says:

    @Jorixine
    You can just forward single application instead of the entire GNOME desktop, that should solve that problem. Instead of typing “ssh -X username@server.ip.address” then type in your app in such as “firefox”.

    Hope that helps :)

  19. David says:

    Ronny, both IP’s and IPs are acceptable and proper in English.

  20. Andrew says:

    @Olev

    While it is not required to set static IPs to “run” SSH. Why would you even use SSH if you can’t connect to it from another computer?

  21. [...] Run Gnome remotely Filed under: Linux, Security — 0ddn1x @ 2008-01-14 21:12:21 +0000 http://infectedproject.com/2007/07/09/forwarding-gnome-via-ssh/ [...]

  22. MarK says:

    I have done this with KDE and it works in 10.4, But when I upgrade to 10.5 the desktop would be stuck on top of every thing so it made work in possible. I just ran the kicker instead of full blown KDE

  23. [...] Forwarding GNOME via SSH This quick and painless tutorial will show how to forward your GNOME session from your Linux box to another computer, via SSH and X11 Forwarding. (tags: tutorial howto ssh x11 gnome gui remote remotedesktop) [...]

  24. [...] Forwarding GNOME via SSH (tags: ubuntu vpn sysadmin) [...]

  25. [...] Forwarding GNOME via SSH [...]

  26. Andrew says:

    @B-Con

    You guys are going to have to excuse me I wrote up this article awhile ago. So I’m trying to read it over again to get the gist of what I was doing then. Apparently this is not the most streamlined approach! It does work, even though there are a few unnecessary steps. ;-)

    I’ll try and clean it up a tad.

  27. [...] Ένα πολύ χρήσιμο how-to για το πώς θα δουλεύετε GNOME μέσω SSH. http://infectedproject.com/2007/07/09/forwarding-gnome-via-ssh/ [...]

  28. wcarlson says:

    NO! Do not use mv, this will reset the permissions on the file to that of the new file!

    Example:

    [wcarlson@g wrk]$ touch testfile testfile1
    [wcarlson@g wrk]$ chmod 600 testfile1
    [wcarlson@g wrk]$ v testfile*
    -rw-r–r– 1 wcarlson users 0 Jan 16 10:18 testfile
    -rw——- 1 wcarlson users 0 Jan 16 10:18 testfile1
    [wcarlson@g wrk]$ mv testfile1 testfile
    mv: overwrite `testfile’? y
    [wcarlson@g wrk]$ v testfile*
    -rw——- 1 wcarlson users 0 Jan 16 10:18 testfile

    Editting the files directly is the correct answer, followed close;y by cp _newfile_ _oldfile_.

  29. Andrew says:

    @wcarlson

    Thanks for the insight, I have went ahead and changed the commands to “sudo gedit”. That should save the existing permissions, correct?

    Plus its much easier to do it that way, instead of the old “gedit” >> save to desktop >> “mv”. :-)

  30. joe says:

    NX is easier and a lot sexier

  31. Stubbs says:

    I’m actually just getting Gtk-Warning **: cannot open display on my gf’s MAC book running 10.4

  32. Andrew says:

    @Stubbs

    Are you typing the “ssh -X” command in normal OS X Terminal? You need to type this in the X11 terminal located in Applications >> Utilities (You might need to download it or install it from the OS X install disk).

    Hope that helps

  33. Tone says:

    Hi, I’m also getting “Gtk-WARNING **: cannot open display:”
    on OSX 10.3.9 (also owned by GF)
    Is there anything else that needs to be installed on the Mac?

  34. thanks for the article, i’ll give it a try.

  35. mieses says:

    Forwarding X and Gnome over SSH seems slower (10 - 100x slower) than VNC when connecting remotely (DSL, Cable modem, etc).

    I’m using Xming + putty to connect from Windows to a remote Linux box. I tried SSH protocol compression. It made things even slower.

    Are you saying that X forwarding shouldbe faster for LAN or for remote connections?

  36. [...] the X11 is running gnome, try the following steps: (I haven’t [...]

  37. bernie actor says:

    bernie actor

    Thanks for the nice read, keep up the interesting posts..

  38. jamie king says:

    jamie king

    Man i just love your blog, keep the cool posts comin..

  39. Matt says:

    Your blog make me chuckle from beginning to end^_^!! It sounds absolutely great to me. Your blog is my favorite!

  40. Top Desktop Computers…

    I know nothing except the fact of my ignorance. ~ Socrates…

  41. Jon says:

    This also did not work under OSX 10.5.5. I loaded xterm up in X11.app as one of the comments pointed out but I still get the symptoms of the desktop not being clickable. The remote server is fedora 9 if that matters. Advice? Did anyone actually get this working?

Leave a Reply





Similar Posts

    None Found

or View a Random Article

Categories

About

My name is Andrew and I happen to be a seventeen year old male (vegetarian, modernist, secularist, humanist, geek) homo sapien. I’m living out my short life on a pale blue dot, orbiting a fusion reactor, located somewhere in one of the spiral arms of our gargantuan galaxy, aimlessly wandering the infinite expanse of the cosmos. You just happened to have reached my tiny corner of the Universe. [...]

Latest Photos

Bedroom 360°Looking FowardReminiscingSilhouetteMyspace January '09 - Neue Year (Updated)My Very Own Font!Domo arigato, Mr. Roboto.Surrounding

Recently Played

  • John Lennon – Nobody Told Me 2 hours ago
  • Lynyrd Skynyrd – Free Bird 2 hours ago
  • The White Stripes – The hardest button to push 2 hours ago
  • Pixies – Where Is My Mind 2 hours ago
  • Bob Dylan – Like a Rolling Stone 2 hours ago
  • Jim Sturgess – I've Just Seen a Face 15 hours ago