Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was trying to make a VNC server in my Ubuntu 11.04, which can allow me to login even system reboots. Therefore, I have tried as following, but from vncviewer I can't connect.

Server listening

  1. Install

    $ sudo -s
    # apt-get install vnc4server xinetd
  2. Security

    # vncpasswd /root/.vncpasswd
  3. As a service

    # vim /etc/xinetd.d/Xvnc
    service Xvnc
        type = UNLISTED
        disable = no
        socket_type = stream
        protocol = tcp
        wait = yes
        user = root
        server = /usr/bin/Xvnc
        server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/X11/fonts/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd
        port = 5901
  4. Start the service

    # service xinetd stop
    # service xinetd start

Client trying

$ vncviewer

TigerVNC Viewer for X version 1.0.90 - built May 10 2011 10:04:22
Copyright (C) 2002-2005 RealVNC Ltd.
Copyright (C) 2000-2006 TightVNC Group
Copyright (C) 2004-2009 Peter Astrand for Cendio AB
See for information on TigerVNC.

Wed Sep  7 10:08:20 2011
 CConn:       connected to host port 5901
 main:        read: Connection reset by peer (104)
share|improve this question
up vote 3 down vote accepted

You might want to try x11vnc - a very powerful, relatively easy to use solution.

Please see my previous answer on a similar topic for more info. That answer also points towards a number of different ways to set x11vnc up as a service on login. I have this working for my own personal server and it's been completely reliable.

share|improve this answer
if i already have other VNC's, what should i do to remove them and freshly put x11vnc according to that other link. – YumYumYum Sep 13 '11 at 21:11
Looking at your apt-get line above, I guess you'd just apt-get remove vnc4server xinetd, then sudo apt-get install x11vnc. Certainly on my system here, xinetd is not installed, so it should be a simple reversal to undo what you've done and install x11vnc. But if they're working, perhaps you could just leave them working - x11vnc is incredibly powerful/versatile/easy to setup, but at the end of the day, delivers the same basic functionality as vnc4server! – Scaine Sep 14 '11 at 17:46

Is port 5901 open?

Service running?

service --status-all
share|improve this answer
On reboot, i have this $ nmap localhost Nmap scan report for localhost ( PORT STATE SERVICE 22/tcp open ssh 5901/tcp open vnc-1 , and service --status-all shows: [ ? ] xinetd – YumYumYum Sep 7 '11 at 10:59
sudo netstat -tap | grep xinetd - Check if xinetd is listening. – mount.cifs Sep 7 '11 at 17:23
grep xinetd /var/log/syslog - Check syslog for errors/clues – mount.cifs Sep 7 '11 at 17:24
Result 1: tcp 0 0 :5901 *: LISTEN 926/xinetd, Result 2: "xinetd[926]: xinetd Version 2.3.14 started with libwrap loadavg options compiled in."xinetd[926]: Started working: 1 available service" , no special error found none almost. – YumYumYum Sep 7 '11 at 19:18
Hmm.. no clue? Tried to connect from a different computer/distro? – mount.cifs Sep 8 '11 at 9:07

I'm expecting that you already install vnc-server and xinetd only you have you do the following

 iptables –I INPUT -p tcp --dport 5900 -j ACCEPT
 chkconfig vncserver on
 server vncserver restart

reboot then try on other PC if it's working.


if you want to access outside make sure you allow the traffic from port 5900 of your Router with the IP address of your VNC server.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.