Open one SSH/VNC connection, but not another

Jaanus Kõusaar jaanusk "at" myrealbox.com
Sat Jan 31 20:22:01 2004


On 26 Jan 2004 at 18:39, William Hooper wrote:

> >    I have set up a VNC server on my SUSE 9 host, and try to connect to
> >    it with Putty/TightVNC.
> >
> >    The  connection  is  established  ok.  Ports  5900  and  5901 are
> >    also forwarded (I can see in the event log of Putty).
> 
> Please describe what your PuTTY settings are.

Host Name: xxx.xxx.xxx.xxx port 113 (this is the only port open on the Linux 
machine, and sshd is listening on that port)

When I connect to the Linux machine, the Putty's event log says:
2004-01-31 22:05:07	Local port 5900 forwarding to localhost:5900
2004-01-31 22:05:07	Local port 5901 forwarding to localhost:5901
2004-01-31 22:05:07	Local port 5902 forwarding to localhost:5902
2004-01-31 22:05:07	Allocated pty
2004-01-31 22:05:07	Started a shell/command

Using: SSH2, compression enabled.

> >    Then I start the VNCserver on Linux machine with
> >
> >    vncserver -depth 16-geometry 1024x768
> >
> >    After that the server announces something like that:
> >
> >    New 'X' desktop is
> >
> >    linux:1
> >
> >    However,  when I try to connect from my Win98 machine with TightVNC
> >    to localhost:1, in the Putty's event log I can see the
> >
> >    Forwarded connection refused by server remark.
> 
> Sounds like it might be an SSH issue.
> 
> >    At  the  same  time,  when connecting to localhost:0, everything
> >    works fine, however the vncserver is that of another user.
> >
> >    I  tried  telnet localhost:1 and it returned a line starting with
> >    RFB, so the VNCserver seems to be working ok.
> 
> On the SSH client machine, or the linux machine?

On the linux machine.

Below is evidence that Xvnc is running.
jaanus "at" linux:~> lsof -Pai -c Xvnc
COMMAND  PID   USER   FD   TYPE DEVICE SIZE NODE NAME
Xvnc    8603 jaanus    0u  IPv4 147372       TCP *:6001 (LISTEN)
Xvnc    8603 jaanus    3u  IPv4 147393       TCP localhost:5901 (LISTEN)
Xvnc    8603 jaanus    4u  IPv4 147394       TCP localhost:5801 (LISTEN)
Xvnc    8968 jaanus    0u  IPv4 165945       TCP *:6002 (LISTEN)
Xvnc    8968 jaanus    3u  IPv4 165977       TCP *:5902 (LISTEN)
Xvnc    8968 jaanus    4u  IPv4 165978       TCP *:5802 (LISTEN)

OK, when I try to connect to port 5902 with the VNCviewer I get connection 
refused:

linux:/home/jaanus # tcpdump -i lo port 5902
tcpdump: listening on lo
22:20:14.624440 localhost.33206 > localhost.5902: S 856660152:856660152(0) win 
32752 <mss 16376,sackOK,timestamp 30424865 0,nop,wscale 0>
22:20:14.624463 localhost.5902 > localhost.33206: R 0:0(0) ack 856660153 win 0

Jaanus