SSH - Advanced Terminal Tricks - Part 1

SSH - Advanced Terminal Tricks - Part 1

Nixie


Let's learn about X11 forwarding... this will allow me to run a graphical program from a remote server and see it locally as if I was sitting right there.
ssh -X nixie@bacon.geekbeacon.org (Note the -X that's the really important part here)
Now, let's validate that the server is configured correctly. The SSH server is configured by a fun little file called sshd_config that usually lives in your /etc/ssh directory.
What we need to confirm is that the option X11Forwarding is set to a value of yes, otherwise flip it from no to yes and restart the server using your favorite service manager. For Ubuntu you can restart in either of the following ways:

  • sudo service ssh restart
  • sudo /etc/init.d/ssh restartOnce ssh has been restarted you can run any application that's installed on your server whether it has a GUI or not. Sadly this won't work for any of your favorite games. I chose gnome-todo as an example but really anything you can think of that you wanted to access will work. Firefox? Chrome? Wunderlist? What's your favorite program you can't live without that you absolutely must have but isn't available everywhere you're at. Do you need access to all that data you have stored on your NAS but don't want to transfer gigs and gigs of data? It doesn't matter, if you run your program with SSH X11 forwarding all the data doesn't need to be transferred and it has the benefits of being secure through SSH.
    X11 forwarding is one of the easiest ways of access a GUI environment remotely, though it does have the draw back of being somewhat slower especially if your app wants to redraw the screen. Don't worry, we'll talk about other more fun ways of bring the GUI over the secure wires next time as we look into SSH Tunnels and VNC.
    What is your favorite SSH tips and tweaks? Llama wants to know! :D :D :D