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
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
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 Comments
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
How about a tutorial on forwarding an X11 session to a Windows computer running cygwin?
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
There’s also the issue of “quicker then”…
-Ronny
@Ronny - What are you, a f**king english teacher? It’s a technical guide, not a f**king spelling test.
@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?
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.
Ronny iz a pees of shyte. There, suck on that you commie bastard.
BTW, nice article!
Comment abuse makes me smile. Ronny, you’re not making friends here!
Bookmarked. Thanks for the article!!!
Why not just use NoMachine? Much easier.
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.
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.
Oh, and one important thing. You do not need to have static IPs set. That is not a required to run X11 or SSH.
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?
so sorry for my horrible english in the last post…
its too early for me here in Argentina
@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 :)
Ronny, both IP’s and IPs are acceptable and proper in English.
@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?
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
@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.
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_.
@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”. :-)
NX is easier and a lot sexier
I’m actually just getting Gtk-Warning **: cannot open display on my gf’s MAC book running 10.4
@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
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?
thanks for the article, i’ll give it a try.
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?
Your blog make me chuckle from beginning to end^_^!! It sounds absolutely great to me. Your blog is my favorite!
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?
Incoming Links
Leave a Reply