Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


setting up x11vnc on Ubuntu 10

Posted on 2011-03-06
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 12

Accepted Solution

upanwar earned 2000 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

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

715 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