Basically what I am looking for is similar feature like RDP on Windows. I should be able to view the login screen through VNC Viewer. Even if server is restarted I should still be able to access it through VNC Viewer. Currently someone has to first obtain the console through OVM (these are all VMs), login and only then is it possible to remote through VNC Viewer.
I know this question has been asked here previously [ref1] [ref2] also here but so far I have been unsuccessful in my attempts. Can anyone provide a detailed guide on how to go about achieving this?
- OS: Oracle Linux 5
- VNC rpm : vnc-server-4.1.2-14.el5_6.6
Update 1 - VNC at User Level
Ok so I followed everything listed here
- Logged in to the server through PuTTY using root (because that's the acount I need to use for logging in through VNC).
- Ran vncpasswd and set the VNC login password.
- Saved the script as
/etc/init.d/vncserverafter changing the following parameters:
chmod +x /etc/init.d/vncserver.
chkconfig --level 2345 vncserver on.
vi /root/.vnc/xstartupand uncommented the lines:
and changed last line from
unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc
startx &(since I'm using GNOME).
- Restarted the server.
Now I could successfully remote to the server through VNC Viewer. This works even if server is restarted. However, it bypasses the lock screen and does not prompt for password. For this I had to set up a password through System > Preferences > Remote Desktop.
Important Note: As @slm described below, this method provides VNC access at user level. Meaning you can create multiple users and provide them VNC access separately. Each user will have a unique desktop. This wasn't exactly what I was looking for though!
Update 2 - VNC at System Level, like RDP on Windows
After implementing @slm's solution, I realised that this was what I actually had in mind when I asked this question. I followed exactly what he said. It's a lot simpler! Couple of things I would like to add:
- I didn't need to install x11vnc. I used only the vnc rpm that was installed by default.
/etc/X11/xorg.conffile was missing. To create it I did the following: (Source)
- As root run:
Xorg :1 -configure. This will create the file /root/xorg.conf.new
cp /root/xorg.conf.new /etc/X11/xorg.conf
- As root run:
I followed rest of the instructions. Restarted gdm and Voila! It worked! I was able to see the login screen through VNC Viewer, exactly like RDP on Windows. It worked even after server restart. Great!