This question is not about RealVNC, as I am trying to connect "directly", without having to create a third-party account somewhere. I have tried tightvnc, tigervnc, ultravnc and the server connection via finder on a mac.

I have a RPi3 with raspbian, connected via router to a windows pc. I can ping it and have no problem with ssh. Despite having server and viewer running in their respective platforms, the viewer connection times out at every attempt. I have no extra monitor, keyboard or mouse; I must connect headless.

I would appreciate help from the experts in establishing a connection. I describe below everything that I did so far in step-by-step form, with some particular details which I think are relevant. I believe I have read and followed the widest possible set of instructions pertaining to this problem, but the connection still just times out. The error message is:

Error in TightVNC Viewer: A connection attempt failed bacause the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

At this point, I think the solution is rather ridiculous, but I cannot find it. Could you experts please assist me? Your help is much appreciated.


1) downloaded latest raspbian, made the necessary modifications to the image to get wifi and ssh going. On the router, I use DHCP with a table tying MACs to IPs (restrited IP address list on the router), so the IP never changes. All devices are visible and I can ping them. SSH works fine via Putty between laptop pc and RPi3.

2) using raspi-config, changed password, enabled vnc, set to boot via graphic interface (I tried setting to command line as well, still timed out).

3) Installed tightvncserver, ran update and upgrade. Reboot. Logged back in via ssh.

4) Ran vncserver :1 -- at this point tried to connect.

On the PC side, installed tightvnc viewer. Later tried UltraVNC viewer as well. On a Mac, I tried tiger vnc and the built-in connection via finder. The viewers were attempted one at a time. They all time out on both PC and Mac. Meanwhile, ssh runs fine.

5) I tried different ports for the server (except 0), to no avail. For the heck of it, I took the service down, and tried to run the command tightvncserver :1 instead. Tried to connect, timed out.

I suspected the service was not running properly (whatever that means), so I killed the job and ran it back again, checking with ps axg | grep vnc -- output shows everything is running as it should. Tried to connect, time out.

6) Following a nice tutorial from xhantor (on the pi forum), I created a new file: /etc/systemd/system/[email protected] with

Description=Remote desktop service (VNC)
After=syslog.target network.target

ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i


Ran systemctl daemon-reload
Ran systemctl enable [email protected]

Reboot, logged back in with ssh (fine)

7) checked if vnc is running, it is indeed. Still, connection times out.

8) checked the log file related to the port open, in .vnc -- log was complaining of the absence of .Xresources file. I created an empty one, rebooted and tried again, and the log file no longer showed complaint.

The service is running, the viewer(s) try, but the connection still times out.

Thanks in advance!

2 Answers 2


"using raspi-config, changed password, enabled vnc" this ONLY works for RealVNC (not sure what would happen if you use others).

"Ran vncserver :1" Do not just run vncserver 0r tightvncserver, although if you copied the script from https://raspberrypi.stackexchange.com/a/39374/8697 this automatically starts at boot, the whole point of the script.

Try running open vnc://[email protected]:5901 on the Mac (changing to your IP) (Does NOT work with RealVNC - you have to use their custom viewer).

  • Thanks @Milliways. I have disabled vnc at start (with raspi-config), rebooted and did not run vncserver:1. The code I took from the tutorial (as posted) ran at startup, of course. The command ps axg | grep vnc shows Xtightvnc :1 running, which is what I expected. Still times out using tightvnc viewer on the pc, as well as on a mac (with open vnc://pi@....::5901). Thanks anyway.
    – Corisco
    Dec 29, 2016 at 2:36
  • @Corisco If you boot to GUI try 5902 to see if this helps
    – Milliways
    Dec 29, 2016 at 4:13
  • 1
    It was the firewall. I never suspected it first because I ran ps axg | grep ufw and there was no job running with ufw. After I read a discussion between Milliways and @goldilocks (raspberrypi.stackexchange.com/questions/58494/…) I checked the iptables and there it was: packets being dropped. My ignorance of the difference between the routing of ssh traffic and vnc traffic, I guess, is what lead me astray. I thought that if I had ssh going then there would be no firewall dropping packets.
    – Corisco
    Dec 30, 2016 at 3:07
  • This port conflicts with XRDP.
    – SDsolar
    Nov 26, 2017 at 2:33

Whenever I tried accessing my Raspberry Pi 4B using VNC Viewer from my MacBook Pro I would get the "timed out" error whenever I typed "raspberrypi" in the connect field. Then I tried typing the IP address of my RPi instead and it worked perfectly. It asked for approval, user name and password. After that I was in and managed to work remotely on my Raspberry Pi. Now I can use it headless without problems.

  • How do you get the ip address? Using name raspberrypi.local instead of only raspberrypi should also work.
    – Ingo
    Oct 20, 2020 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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