Tuesday, December 7, 2010

Logging into Ubuntu from another Ubuntu Machine and View Remote Display

Lets call the machine on which we want the display to be shown as client machine, and the machine from which the display will be shown as the server machine. 
SSH supports X forwarding. To enable X forwarding on the server, first install ssh using 

sudo apt-get install ssh
Then, edit /etc/ssh/ssh_config to set 

ForwardX11 yes
On the client, you need to start a new X server by running: 

sudo xinit -- :2
Then on the client, run 
ssh -X server -l user 
After logging in onto server via ssh, do "echo $DISPLAY". This variable should have been set by ssh. Then run "gnome-session" on the server. You can now see it displayed onto your client. 
Do "Ctrl+Alt+F7" to go back to the X server working with your client, and "Ctrl+Alt+F8/F9" to toggle to the display received from the server.
After logging into the server, you might get errors like: 
/usr/bin/xauth: error in locking authority file /home/user/.Xauthority.
The following resolved the issue for me: 

xauth -b quit

No comments: