setting up x11vnc on Ubuntu 10

Posted on 2011-03-06
Last Modified: 2012-05-11

I have root access to a ubunut 10 VM which i normally connect to via putty. I am trying
I am a linux novice trying to connect to ubunutu 10 via x11vnc.

I have tried to install x11vnc on the machine as follows
sudo apt-get install x11vnc vnc-java
x11vnc -storepasswd

 iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 5900 -j ACCEPT
iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 5800 -j ACCEPT

x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800

 This seems to load ok but removes the shell prompt. I presume the server has started and is listening on the ports so i used another putty window to reconnect to my machine and ran sockstat -l and xllvnc is listening on the 2 ports.

 I then downloaded realvnc windows client and entered the hostname to connect
If i entered just the hostname or hostname:5900 i get a timeout error but if i enter hostname:5800 i get 'connection refused' error

I have been advised this is not the best way and i should start the server like so

x11vnc -auth -forever guess -display :0 -localhost -rfbport 20000 -xkb

 I tried starting the server like this but i got a warning saying i was running the server without a password.
There does appear to be an encrypted password in ~/.vnc/passwd though so i tried this instead

x11vnc -auth -forever guess -display :0 -localhost -rfbport 20000 -xkb -rfbauth ~/.vnc/passwd

There was some loading messages.
The root prompt returned so i assumed the server must be running in the background so i tried ps -ef | grep vnc to look for it but nothing was listed. How do i stop the vnc servers I have started???

I tried connecting via realvnc (with port 2000) but got connection refused. The linux machine uses a non-standard port for SSH so I don't know if realvnc is trying to connect via ssh over the standard port with forwarding to port 2000?

Note: please do not simply post a link to a website with instructions as your answer as I will not award the points. I have already looked at many websites and it seems I am unable to do this without some human guidance

thanks a lot
Question by:andieje
  • 4
  • 2
LVL 12

Accepted Solution

upanwar earned 500 total points
ID: 35046656
To set password for vnc, run the command
# vncpasswd

To check whether VNC is running or not execute the below given command.

# ps -ef | grep -i vnc

If it dont show anything it means that VNC is not running on your box.

To check on which post your VNC is listening just run the command.

netstat -natp | grep -i vnc

It will show you the port on which VNC is listening.

Check on which ports your box is listening.

netstat -an | grep "LISTEN"

Check the which ports are open with below given command.

iptables -L -v

To check from your windows box whether your Linux box is listening on particular box or not just run the below given steps.

Start ---> Run ----> cmd

on command prompt execute below given command

telnet <ip address of linux box> <port>

If you are getting ^ Escape character, it means port is open otherwise there is some problem like if you get error message 'connection refused' it means server is not running on that port.

Hope these steps will help you to troubleshoot your issue but still if you face any issue or have any query. Please feel free to ask us.

Author Comment

ID: 35047378
it looks as though the vnc server is exiting as it loads.

It seems to start

06/03/2011 20:03:53 passing arg to libvncserver: guess
06/03/2011 20:03:53 passing arg to libvncserver: -rfbauth
06/03/2011 20:03:53 passing arg to libvncserver: /root/.vnc/passwd
06/03/2011 20:03:53 passing arg to libvncserver: -rfbport
06/03/2011 20:03:53 passing arg to libvncserver: 5900
06/03/2011 20:03:53 x11vnc version: 0.9.9 lastmod: 2009-12-21  pid: 27843
06/03/2011 20:03:53 Using X display :0
06/03/2011 20:03:53 rootwin: 0x101 reswin: 0x1600001 dpy: 0xbce480

then it ends like this and returns to the promopt

06/03/2011 20:03:53 Default visual ID: 0x21
06/03/2011 20:03:53 Read initial data from X display into framebuffer.
06/03/2011 20:03:53 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/3200
06/03/2011 20:03:53 *** unrecognized option(s) ***
06/03/2011 20:03:53     [1]  guess
06/03/2011 20:03:53 For a list of options run: x11vnc -opts
06/03/2011 20:03:53 or for the full help: x11vnc -help
06/03/2011 20:03:53
06/03/2011 20:03:53 Here is a list of removed or obsolete options:
06/03/2011 20:03:53
06/03/2011 20:03:53 removed: -hints, -nohints
06/03/2011 20:03:53 removed: -cursorposall
06/03/2011 20:03:53 removed: -nofilexfer, now the default.
06/03/2011 20:03:53
06/03/2011 20:03:53 renamed: -old_copytile, use -onetile
06/03/2011 20:03:53 renamed: -mouse,   use -cursor
06/03/2011 20:03:53 renamed: -mouseX,  use -cursor X
06/03/2011 20:03:53 renamed: -X,       use -cursor X
06/03/2011 20:03:53 renamed: -nomouse, use -nocursor
06/03/2011 20:03:53 renamed: -old_pointer, use -pointer_mode 1

Author Comment

ID: 35047446
if i do the telnet command to the ssh port then it seems ok

if i used the vnc port i get the message 'connecting to server' and then the window closes automatically after about 30 secs
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.


Author Comment

ID: 35047461
the port 5900 appears to be open but i believe i don't need any other ports to be open to do ssh tunnelling

the first problem is that the vnc server is not starting

Author Comment

ID: 35058221
i got the server to start and is listening on port 5900 - i checked all of the above.

x11vnc  -forever  -display :0 -localhost  -xkb -rfbauth ~/.vnc/passwd

 i then tried to set up the client like so:

Setup the Client PC:
Launch PuTTY.
Under session:
Host Name: your Unix box FQDN or IP
Click SSH
Give the session a name

Under: Connection / SSH / Tunnels
Enter a port forward for Local
Source Port: 5901
Destination: localhost:5900
Click Add

Click on session again and save it.

Now launch (Open) your PuTTY session and logon to your Linux box's SSH
 launch  VNC Viewer and enter localhost:1

with realVNC i got connection refused error 10061
LVL 12

Expert Comment

ID: 35059502
Could you please run below given commands on your Linux box and provide the output.

netstat -an | grep "LISTEN"

ps -ef | grep -i vnc

iptables -L

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question