# VNC not working (can't connect)

## bsander

Hey all,

I've been trying to set up my home computer so that I can connect to it from my university. I used this howto to set up a vnc server. I followed every step closely (at least I think i did   :Shocked:  ), but it isn't working. This is what I get:

```
$ vncviewer localhost:71

vncviewer: ConnectToTcpAddr: connect: Connection refused

Unable to connect to VNC server
```

Here are the files I edited while working through the howto:

/etc/xinetd.conf

```
# Copyright 1999-2004 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/sys-apps/xinetd/files/xinetd.conf,v 1.6 2004/07/15 00:53:48 agriffis Exp $

# Sample configuration file for xinetd

defaults

{

#       only_from      = localhost

        instances      = 60

        log_type       = SYSLOG authpriv info

        log_on_success = HOST PID

        log_on_failure = HOST

        cps            = 25 30

}

includedir /etc/xinetd.d

```

/etc/X11/xdm/xdm-config

```
! $Xorg: xdm-conf.cpp,v 1.3 2000/08/17 19:54:17 cpqbld Exp $

!

!

!

!

! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.10 2002/11/30 19:11:32 herrb Exp $

!

DisplayManager.errorLogFile:    /var/log/xdm.log

DisplayManager.pidFile:         /var/run/xdm.pid

DisplayManager.keyFile:         /etc/X11/xdm/xdm-keys

DisplayManager.servers:         /etc/X11/xdm/Xservers

DisplayManager.accessFile:      /etc/X11/xdm/Xaccess

DisplayManager.willing:         su nobody -c /etc/X11/xdm/Xwilling

! All displays should use authorization, but we cannot be sure

! X terminals may not be configured that way, so they will require

! individual resource settings.

DisplayManager*authorize:       true

! The following three resources set up display :0 as the console.

DisplayManager._0.setup:        /etc/X11/xdm/Xsetup_0

DisplayManager._0.startup:      /etc/X11/xdm/GiveConsole

DisplayManager._0.reset:        /etc/X11/xdm/TakeConsole

!

DisplayManager*chooser:         /etc/X11/xdm/chooser

DisplayManager*resources:       /etc/X11/xdm/Xresources

DisplayManager*session:         /etc/X11/xdm/Xsession

DisplayManager*authComplain:    true

! SECURITY: do not listen for XDMCP or Chooser requests

! Comment out this line if you want to manage X terminals with xdm

! DisplayManager.requestPort:   0

```

/usr/kde/3.3/share/config/kdm/kdmrc (which was in another place than the howto said it would be, but it was the only one i could find)

```
-snip-

[Xdmcp]

Enable=true
```

 /etc/X11/xdm/Xaccess (filtered all comments out)

```
*                                       #any host can get a login window
```

And I made those two new files with the contents from the howto.

It's probably something trivial, but I can't figure it out.. Who can help me?

----------

## bk0

Your machine doesn't appear to be listening on the port you're trying to connect to. Check your vnc server config.

Do you really want to set up a terminal server, or do you just want to access your machine remotely? A terminal server seems like overkill here.

----------

## bsander

 *bk0 wrote:*   

> Your machine doesn't appear to be listening on the port you're trying to connect to. Check your vnc server config.

 Where do I find that file and what should I look for exactly? I'm kinda new to this..

 *Quote:*   

> Do you really want to set up a terminal server, or do you just want to access your machine remotely? A terminal server seems like overkill here.

 I just want to access my machine remotely. Is there a better way to do this? How?

----------

## fleed

Forget all that setup crud. Just run vncserver and look for the screen it's going to use. If you dont' have any other vnc servers running it will most likely be screen 1. Then to connect to it you simply need to run vncviewer machine:1 (or whatever screen number).

Hope that helps.

----------

## bsander

 *fleed wrote:*   

> Forget all that setup crud. Just run vncserver and look for the screen it's going to use. If you dont' have any other vnc servers running it will most likely be screen 1. Then to connect to it you simply need to run vncviewer machine:1 (or whatever screen number).
> 
> Hope that helps.

 It helped, it worked. But when I connect, I just get a terminal (graphical, yes, but only a terminal). When I type 'startkde' in there, it works, but everything (even the kicker and other external toolbars) have green window borders and title bars. How can I set it up so that it "just" displays anything kde? (Be it a login window or even better, my personal desktop)

----------

## fleed

For what you're trying to do a better idea might be to use x2vnc. x2vnc connects to your current physical X11 session on your machine and makes it available through vnc. So you can control it as if you were controling a windows vnc session, i.e., the physical X11 session on :0.0 or your desktop. Advantage is that you get seemless integration between your client and your server machines. As soon as you get home what shows on screen will be what you were looking at remotely.

----------

## bsander

 *fleed wrote:*   

> For what you're trying to do a better idea might be to use x2vnc. x2vnc connects to your current physical X11 session on your machine and makes it available through vnc. So you can control it as if you were controling a windows vnc session, i.e., the physical X11 session on :0.0 or your desktop. Advantage is that you get seemless integration between your client and your server machines. As soon as you get home what shows on screen will be what you were looking at remotely.

 Sounds good  :Smile: .

I've emerged it, but when I try it I get this:

```
~: x2vnc localhost:1

x2vnc: VNC server supports protocol version 3.3 (viewer 3.3)

Password:

x2vnc: VNC authentication succeeded

x2vnc: Desktop name "sander's X desktop (notebook-gentoo:1)"

x2vnc: Connected to VNC server, using protocol version 3.3

x2vnc: VNC server default format:

Warning: Failed to bind x2vnc hotkey, hotkey disabled.
```

It seems to hang there. Of course, this is probably because I tried it with localhost.

However, does that mean my issue with the graphical environment was just a client issue? Because when I'm at the university I have to connect from a windows or a unix box (on which I cannot and may not install x2vnc), so I don't really see how this can help me.

Or am I just overlooking something?

----------

## nobspangle

vncviewers don't need installing and any viewer can be used to connect to any server, the vncview binaries fit on a floppy disk and can be run from there.

to get x2vnc to run on display 0 you need to edit your XF86Config to make it load the module vnc.so

----------

## fleed

If x2vnc is too complicated try x11vnc first. x11vnc can be run from within a running X11 session and is way simpler to install than x2vnc. 

Agree with nobspangle, the viewer is almost just an image viewer, it just displays the graphics from the remote server and cares not what that may be.

----------

