# tightvnc "ConnectToTcpAddr: connect: Permission denied"



## trev (Feb 20, 2015)

OS: FreeBSD shadow.sentry.org 9.2-STABLE FreeBSD 9.2-STABLE #0 r263071

Hardware:
-- Mac Mini 3,1 (late 2009)
-- DLink USB wireless (Ralink Technology USB IEEE 802.11a/g/n wireless network device)
-- Fritz!Box 7390 Wireless Router (50/20 Mb/s ISP Fibre connection; VOIP etc)

I've been using tightvnc (from ports) from home to my FreeBSD 8.4-STABLE system at work via ssh for over a year since relocating interstate. It has been flawless, until yesterday. While the connection to the net didn't dropout, it became unresponsive for long enough that vncviewer closed down. When the connection to the net resumed working a few minutes later, I could no longer vnc to work but would get the error:

```
ConnectToTcpAddr: connect: Permission denied
```
I could still ssh to work. I could still browse the web and mail was still being received by the mail server (same home machine). Coincidentally, my wife's iPad could no longer reach the net.

I eventually solved the vnc issue by rebooting. As for the iPad, it eventually resumed working some hours later (power off/on, WiFi off/on didn't help).

My friend Google doesn't seem to have much to say on the subject at all. I put the whole issue down to a shift in the earth's magnetic core and decided to forget it happened.

Until today. It happened again. On checking with netstat I could see that the ssh session was still established. Ahah. So I restarted sshd and it went to TIME WAIT and then disappeared. I doubled checked the work system was no longer connected, restarted vncserver at work, and then tried vncviewer again. Same error.

Shutting down to single user mode and restarting X didn't help. After a reboot, it was fine again. The iPad is still not playing.

Anyone have any ideas on why a reboot is necessary? I'm all out!


----------



## gqgunhed (Feb 20, 2015)

Hi trev, there are a lot of places to look for errors in this case.
As your wife's iPad has issues too it seems to me like there is a problem within your home network or its internet connection as a change at your remote (work) side hopefully does not affect your home network.

Did something change within the settings of your Fritz!Box? For example DHCP settings, your ISP switched from IPv4 to IPv6 or something other funny "improvements"?
Do any errors show up in the logs of your local and/or your remote machine?
Do you see any strange behavior or traffic when looking at the network communication with tcpdump(1)? Maybe your machines can talk to the outside but the answer packets do not return home?
Do you have drops/timeouts on your outbound internet connection?
It will require some investigation to find a cause here. The above points are just wild guesses 
Personally I think it's the Fritz!Box or the internet connection, but I may be totally wrong.
Good luck narrowing it down.


----------



## trev (Feb 21, 2015)

gqgunhed said:


> As your wife's iPad has issues too it seems to me like there is a problem within your home network or its internet connection as a change at your remote (work) side hopefully does not affect your home network.



In this instance I just assumed the iPad was "temperamental" because my Mac Mini and hers still functioned and her iPad could receive mail from my server, just not access the web directly which the other systems could without issue.



> Did something change within the settings of your Fritz!Box? For example DHCP settings, your ISP switched from IPv4 to IPv6 or something other funny "improvements"?



Not that they're willing to share (though I do have an open issue with them as I can't access the ex-Government monopoly Telco via their connection - fine from work using the national education backbone). I'm beginning to suspect the issue might lie more at the ISP end...



> Do any errors show up in the logs of your local and/or your remote machine?



Alas, no. I scoured the log files in /var/log and my ~./vnc directories both at home and at work.



> Do you see any strange behavior or traffic when looking at the network communication with tcpdump(1)? Maybe your machines can talk to the outside but the answer packets do not return home?



No everything seems tickety boo. I did notice when attempting the denied vnc connection that the `ssh` session login was successful at the work machine. Restarting `sshd` and the `vncserver` there didn't help.



> Do you have drops/timeouts on your outbound internet connection?



Every one to three months which I put down to maintenance by my ISP (fibre reseller) or NBNCo (Government fibre connection supplier) because it always happens in the wee small hours of the morning.



> It will require some investigation to find a cause here. The above points are just wild guesses



Thanks for the detailed input: it is much appreciated.



> Personally I think it's the Fritz!Box or the internet connection, but I may be totally wrong. Good luck narrowing it down.



That'd be right... the one thing I have no backup for given the cost. On the upside it does have a 5 year warranty of which I'm only 20% the way through. On the downside, I live in the country and the supplier is interstate. I'm still not convinced though. I might just have to order its replacement and give it a go. I might also try remembering to see if `tcpdump` at both ends sheds any light on the issue next time it happens. Thanks for that suggestion!


----------

