Install and Config VNC
- Install and Config VNC
- RHEL / Oralce Linux / CentOS
- Starting the Server
- Start VNC Automatically
RHEL / Oralce Linux / CentOS
Check if the package is installed.
If not, install it by using YUM.
Open the ports
- Click on System->Administration->Security Level and Firewall.
- Click on "Other ports" below.
- Click "Add" button.
- Enter 5000-5999 tcp to the "Port(s)" box.
- Click OK.
- Click Apply.
Alternatively, add the rules manually using iptables
Or simply disable Firewall. It also can be done by stopping the init script.
Enabling Remote Visual Access
Open the ~/.vnc/xstartup with a text editor and uncomment the following lines, also make sure the user has read and write permission:
Starting VNC Server as a service ( xvnc daemon)
Create a soft link in the rcX.d folder:
Or simply use the chkconfig command
Check the /etc/rcX.d folder and you'll find the soft links created in the specified run level folders.
Alternatively (NOT recommended), add the following line in ~/.vnc/xstartup and chmod the file to 755:
or alternatively, you can apply the following command in a root terminal:
Open the /etc/init.d/vncserver with a text editor and add the users you want to activate the access to into VNCSERVERS parameter:
Starting the Server
Running the VNC Server manually
This command will ask you to set an access password. You can later change this initial password with vncpasswd command.
Restart the VNC Server
Note that this will terminate all the active listeners.
Connect to the VNC Server
Kill a VNC Session
Start VNC Automatically
VNC start script resides in /etc/init.d/vncserver
Connect using VNC viewer, for example tightvnc viewer: hostname/IP.
Sample /etc/sysconfig/vncserver which starts vnc server on hostname:2 - port 5902 as user oracle
Start VNC Server at boot time
VNC (Virtual Network Computing) is a very useful network graphics protocol (applications running on one computer but displaying their windows on another) in the spirit of X, however, unlike X, the viewing-end is very simple and maintains no state. It is a remote framebuffer (RFB) protocol.
Some VNC implementations: RealVNC, tightvnc, UltraVNC.
x11vnc is a VNC server for real X displays, it allows one to view remotely and interact with real X displays (i.e. a display corresponding to a physical monitor, keyboard, and mouse) with any VNC viewer. In this way it plays the role for Unix/X11 that WinVNC plays for Windows.
Difference between x11vnc and traditional VNC (vncserver)
- For Unix, the traditional VNC implementation includes a "virtual" X11 server Xvnc (usually launched via the vncserver command) that is NOT associated with a physical display, but provides a "fake" one (display) which X11 clients (xterm, firefox, etc.) can attach to. A remote user then connects to Xvnc via the VNC client vncviewer from anywhere on the network to view and interact with the whole virtual X11 desktop.
- x11vnc - interact with real X displays (i.e. a display corresponding to a physical monitor, keyboard, and mouse) with any VNC viewer.
NOTE: Ubuntu desktop, which by default uses either GNOME or Unity runs vino by default, which requires an active GNOME desktop session. DO NOT use it.
Ubuntu / Debian
Create VNC password
NOTE: defaults to ~/.vnc/passwd file. Alternatively, use vncpasswd or
-storepasswd pass file
Store password pass as the VNC password in the file file. Once the password is stored the program exits. Use the password via "-rfbauth file". If called with no arguments, "x11vnc -storepasswd", the user is prompted for a password and it is stored in the file ~/.vnc/passwd. Called with one argument, that will be the file to store the prompted password in.
Change the VNC port to listen on
The VNC port to listen on (a LibVNCServer option), e.g. 5900, 5901, etc. If specified as "-rfbport PROMPT" then the x11vnc -gui is used to prompt the user to enter the port number.
This force x11vnc to use port 5901 (this is VNC display :1.)
If something else is using that port x11vnc will exit immediately. If you do not supply the -rfbport option, it will autoprobe starting at 5900 and work its way up to 5999 looking for a free port to listen on.
In that case, watch for the PORT=59xx line to see which port it found, then subtract 5900 from it for the VNC display number to enter into the VNC Viewer(s).
The "-N" option will try to match the VNC display number to the X display (e.g. X11 DISPLAY of :5 (port 6005) will have VNC display :5 (port 5905).)
Also see the "-autoport n" option to indicated at which value the auto probing should start at.
Send x11vnc to background
Go into the background after screen setup. Messages to stderr are lost unless -o logfile is used. Something like this could be useful in a script
Use SSH to tunnel VNC connection
VNC password file
The option "-rfbauth .vnc/passwd" provides additional protection by requiring a VNC password for every VNC viewer that connects. The vncpasswd or storepasswd programs, or the x11vnc -storepasswd option can be used to create the password file. x11vnc also has the slightly less secure -passwdfile and "-passwd XXXXX" options to specify passwords.
Very Important: It is up to YOU to tell x11vnc to use password protection (-rfbauth or -passwdfile), it will NOT do it for you automatically or force you to (use -usepw if you want to be forced to.) The same goes for encrypting the channel between the viewer and x11vnc: it is up to you to use ssh, stunnel, -ssl mode, a VPN, etc. (use the Enhanced TightVNC Viewer (SSVNC) GUI if you want to be forced to use SSL or SSH.) For additional safety, also look into the -allow and -localhost options and building x11vnc with tcp_wrappers support to limit host access.