# TIGHTVNC configuration howto

## Impalatore-polacco

Hi all,

I've just installed the tightvnc and I've setup a VNC server over SSH, but when I connect to it I see only the X server without window manager and without kde.

Somebody can help me to setup tightvnc to share the current display without creating new X session?

Kregards.

----------

## ddriver

There are several ways to set this up. I run the VNC servers from within the xdm config. I add a line such as:

:1 local /usr/bin/Xvnc :1 -geometry 1024x768 -rfbwait 120000 -rfbauth /home/userid/.vnc/passwd -rfbport 5901 -depth 24 -auth /root/.Xauthority

to my /etc/X11/xdm/Xservers file. Of course you have to be running xdm for this. I don't think it works as well with kdm or gdm.

There is another way to do it using xinetd, not sure how.

----------

## Impalatore-polacco

Thanks, I've tryed but without success, my xdm is up and running but after setting up

```
:1 local /usr/bin/Xvnc :1 -geometry 1024x768 -rfbwait 120000 -rfbauth /home/userid/.vnc/passwd -rfbport 5901 -depth 24
```

nothing changed.

Thks for the interest.

----------

## coolsnowmen

I change that in my server:~/.vnc/xstartup file

e.g.

```
#!/bin/sh

/usr/bin/e16 &

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

```

----------

## Impalatore-polacco

TO:coolsnowmen

OK thks...now I'm able to start a new kde session in my :1 display...but if I want to connect to the display :0 where there is a session already running maybe where is connected another user, how to configure the forward to display 1 from display 0? 

I also receive an error when I try to restart the vnc-server session:

```
el-loco-asus test # /etc/init.d/vnc restart

 * Stopping TightVNC server ...                                                                        [ !! ]

 * WARNING:  vnc has already been started.
```

----------

## coolsnowmen

As far as killing a vncserver, I am cli  :Sad:  so you'ld have to look at the service

I use 

```
vncserver -kill :display
```

to share sessions like that you have to have X setup correctly...

If you havn't ever seen this: http://gentoo-wiki.com/HOWTO_Xvnc_terminal_server

There are some references to the X module, but it looked annoying (because tightvnc which I use, doesn't provide the xorg module so I never did it).

I'll be happy to try and help you understand/fix anything, but understand, if you read that page, you will basically know as much as me.

----------

## Impalatore-polacco

Nope...I use the vncserver -kill :1 to kill the connection to that display, but I receive this error:

```
test@el-loco-asus ~ $ vncserver -kill :1

Can't find file /home/test/.vnc/el-loco-asus:1.pid

You'll have to kill the Xvnc process manually

```

but there is no trace of any vnc process...

And when I try to stop vnc:

```
el-loco-asus test # /etc/init.d/vnc stop

 * Caching service dependencies ...                                                                    [ ok ]

 * Stopping TightVNC server ...                                                                          [ !! ]

```

But after the restart if I kill the connection with vncserver command the operation end successfully, the problem appear when I try to restart the VNC service.

I have another question...there is a way to use the UDP protocol instead TCP? I want to use the port UDP 5901

EDIT:

Usually I use putty to create an SSH tunnel in order to forward the VNC client port to VNC serevr port, but I want to do the forward for UDP ports

----------

## coolsnowmen

 *Impalatore-polacco wrote:*   

> Nope...I use the vncserver -kill :1 to kill the connection to that display, but I receive this error:
> 
> ```
> test@el-loco-asus ~ $ vncserver -kill :1
> 
> ...

 

Did you run that on the server or the client?  Did you run that as the same user the vnc runs as?  But you shouldn't need to.  if the service is setup right, it should beable to start and stop that server. 

Do you know you can set this in /etc/conf.d/vnc ,  what does yours look like?

----------

## Impalatore-polacco

I've executed

```
test@el-loco-asus ~ $ vncserver -kill :1

Can't find file /home/test/.vnc/el-loco-asus:1.pid

You'll have to kill the Xvnc process manually 
```

with the same user of the connection, and I've tried a loopback connection to the server, so I have executed the command on the server machine.

----------

## coolsnowmen

Is vnc even running?!

```
ps -aef | grep Xvnc
```

----------

## Impalatore-polacco

```
ps -aef | grep Xvnc

test      8128  7848  0 00:21 pts/1    00:00:00 grep --colour=auto Xvnc

```

??

If I do the ps -A I cannot se any Xvnc

EDIT:

I'm going sleep now...I will reply you tomorrow.

----------

## coolsnowmen

If vnc is not running, then I'm assuming you can't connect to it.  Can you start one then...I feel lost in what problem you are currently having?  Is it that you can't use the service to restart a vncserver?

Also, if using the service, what is the conf.d/vnc look like (I asked earlier too).

----------

## Impalatore-polacco

When I receive this errors I cannot connect to the VNC server and also I cannot start a new VNC session, it seems tightvnc hangon.

this is my conf.d/vnc:

```

DISPLAYS="test:1"

# Specify any of vncserver(1) and Xvnc(1) options. See the respective man pages for more information.

VNC_OPTS="-geometry 1280x800 -depth 16 -localhost"

```

----------

## coolsnowmen

how is your problem comming?

Are you connecting with user "test"?  Do you even have a user "test"?

----------

## Impalatore-polacco

Yep, test user is my default one.....the problem appear when I try to restart the vnc service. If I boot my gentoo box from off status and I do a clean login, the first thing I try to do is to restart the service of vnc but with no success.

----------

