Go Premium for a chance to win a PS4. Enter to Win


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
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.


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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

971 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