Friday, 10 May 2013

Enable SSH X11Forwarding to access Ubuntu from the local Mac OS X

X11Forwarding config in ssh can enable the remote desktop access from the local client. This is a set up of access between Ubuntu server and local Mac Client.

1. Ubuntu Server
  • make sure the X11Forwarding option in /etc/ssh/sshd_config is set to yes. If not, set it to yes, and restart the sshd service by "sudo service ssh restart"
  • test X11Forwarding in server
    • Open a terminal in Ubuntu, and "ssh -v -X localhost" to establish the ssh connection with X11Forwarding. 
    • Check if there's a line with "Requesting X11 Forward" shown in the debug output
    • Check DISPLAY environment variables by "echo $DISPLAY" and it should be localhost:10.0
2. Mac OS X client
Reference: http://ruepprich.wordpress.com/2013/01/08/x11-forwarding-on-os-x-10-8-2-mountain-lion/
  •  Install  XQuarz for Mac OS
  • Open iTerm and add remote server to access list by "sudo xhost + 192.168.56.101"
    • There's an error about 'xhost: unable to open display ""' 
    • And ssh -X user@192.168.56.101 also failed to take X running
  • Open XQuarz, and open "Terminal" in Application Menu
    • bash-3.2$ xhost + 192.168.56.101
      192.168.56.101 being added to access control list
    • bash-3.2$ ssh -X rye@192.168.56.101
    • rye@rye-desktop:~$ echo $DISPLAY
      localhost:11.0
    • xclock works

1 comment :