What we will learn: In Part 1 we learned how to do Remote Desktop with “Desktop Sharing” method. However in that method it is not possible to do remote desktop unless we physically log in to the machine first. This is really not convenient for system administrators who are trying to manage a Linux serve. Every time a server has to be restarted you will need to physically go to the machine and log in first and then only you can remotely access the machine. The trick is to start the VNC server when the GDM or KDM script is called. I will show you how to do with GDM.
Step 1: Edit the GDM initialization file
# nano /etc/gdm/Init/Default
go at the very end of the file and add the following line just before “exit 0″ line:
Save and quite the file.
This basically tells GDM initialization script to start the VNC server before the script exits.
Let’s suppose you now try to connect to your Linux box after you restart the machine without physically login. What you will see is that you are able to see the GDM login screen remotely. However as soon as you enter your username and password the connection will break. This happens because GDM kills all the clients before it exits. So we need to do the following step in resolve the final issue.
Step 2: Edit GDM configuration file
# nano /etc/gdm/gdm.conf
and find the daemon section which will be something like [daemon]. Now add the following line in this section:
Save and quit the file.
That’s it! Now go to your Machine 2 which either can be Windows or Linux machine and try to connect to your Linux server remotely after a fresh restart and you should be able to see the GDM login screen and once you enter your username and password you should be able to log into your GNOME desktop./session.
Remember that whatever we have seen so far in these 2 parts is “Desktop Sharing” method i.e. you will share the screen with another user who is also connected remotely to Linux server (Machine 1) or with the person who is physically present on the Linux server.
In next part we will see how to connect with individual user login in which the remote user does not have to share the desktop.