VNC Server Installation
The VNC server is specifically designed for this purpose. The installation is pretty straight forward as mentioned in this link. However, there are chances you may encounter some issues while installing. So, I am describing the issues that I faced and how I resolved them.
yum install vnc vnc-server
We need to decide which user will be using the vnc-server.
su vncuser
Now, we need to set the password.
vncpasswd
As a root user, perform the below operation.
vim /etc/sysconfig/vncservers
Add the below 2 lines.
VNCSERVERS="1:vncuser"
VNCSERVERARGS[1]="-geometry 1600x1200"
Type the below commands.
service vncserver start
service vncserver stop
chkconfig vncserver on
If the above commands are successful, we need to edit the xstartup
file for whom we have configured the vncserver
. So, in our case, we have configured it for the user vncuser
. So,
su vncuser
vi ~/.vnc/xstartup
Uncomment the below 2 lines.
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
If the above step is also successful, we are finished with the configuration of the VNC server. However, we need to configure the firewall to permit the vnc communication. In the link, it is mentioned to directly edit the /etc/sysconfig/iptables
file which is a very wrong approach. Instead do the below step.
iptables -I INPUT 1 -p tcp --dport 5901 -j ACCEPT
We have made the changes. But we need to change them.
/etc/init.d/iptables save
service iptables restart
service vncserver start
Now, we can view this machine as vncuser
from a network machine by typing the below commands.
vncviewer
#Enter the server name as,
servername:1 #1 because, we opened up port 5901.
Best Answer
The proper solution: get a VNC client that can send those keys. Like jsbillings says, some clients give you the option of sending keys to the remote via a menu. With the standard
xvnc4viewer
, you can use the-MenuKey
option to set the key that activates the menu. Again, as per jsbillings' answer, the default key is F8.The hack: if you have a shell running on the remote server, try
chvt 3
(orsudo chvt 3
). On the console, you don't need Ctrl+Alt+F#, you can use Alt+F# (or Alt+→ repeatedly) to go back to the X server's TTY. Or just log in and saysudo chvt 7; logout
(or whatever the X VT is).The stupid kludge: since Ctrl+Alt+F# is captured early by the X server, the direct (and hard) way is to disable (temporarily or permanently) these keys. This requires you to modify your X configuration and is an annoying thing to do, and probably a bad idea besides. Go with one of the others. :)