VNC Server port is closed
I asked another question and this is specific to TigerVNC Server.
From https://askubuntu.com/a/1254109/1027810 :
TigerVNC by default listens only on the loopback network interface. This is good for security, so that only you on the very same computer can connect.
Of course, if you want to connect remotely, you need to specifically specify it as follows:
When you start the server from the command line, add
-localhost no
to the command line.tigervncserver -localhost no :1
Configure TigerVNC to permanently listen to all network interfaces in
/etc/vnc.conf
. Add the following. Note that the configuration file gives the impression thatno
is the default. They do not follow the convention that if a configuration is commented out in the config file, it should have the default value (and not the other value you would normally change to).$localhost = "no";
adazem009
Updated on September 18, 2022Comments
-
adazem009 over 1 year
I installed TigerVNC server on my Ubuntu server but I can't connect to it. The server is running but when I try to scan for open ports (in LAN) using my phone, 5901 is closed.
Output of
nmap localhost
:Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-25 08:02 UTC Nmap scan report for localhost (127.0.0.1) Host is up (0.00026s latency). Not shown: 995 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 631/tcp open ipp 5901/tcp open vnc-1 Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds
I think the problem is here. Output of
nmap 192.168.0.101
:Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-25 08:05 UTC Nmap scan report for cloud.local (192.168.0.101) Host is up (0.00039s latency). Not shown: 998 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http Nmap done: 1 IP address (1 host up) scanned in 0.58 seconds
What I've already tried:
- Allow port 5901/tcp in firewall
- Disable firewall and reboot
EDIT: Output of
nmap 192.168.0.101 -p 5900-5901
:Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-25 09:50 UTC Nmap scan report for cloud.local (192.168.0.101) Host is up (0.00032s latency). PORT STATE SERVICE 5900/tcp closed vnc 5901/tcp closed vnc-1 Nmap done: 1 IP address (1 host up) scanned in 0.12 seconds
-
bhordupur almost 4 yearsThe reason it did not scan port 5901 because lIRC it does scan the most common 1000 ports for each protocol. try to add -p flag and mention the range which can cover 5901
-
Parsa Mousavi almost 4 yearsAre you sure the error is about the port being closed ? Try NMAP with the -p5000-6000 option.What's exactly the error messages you get when running the client in the terminal ?
-
bhordupur almost 4 yearsLook at this doc nmap.org/book/man-port-specification.html
-
adazem009 almost 4 years@Mousavi Yes, when I try to scan port range 5900-5902 using my mobile phone, these ports are closed.
-
bhordupur almost 4 yearshave you tried to check list of open ports using netstat or similar other than nmap in your systems?
-
adazem009 almost 4 years@bhordupur No, I only tried to scan it via Net Analyzer app for Android.
-
bhordupur almost 4 yearsTwo things at this moment I can think about to trouble shoot the problem (1) making sure port is listening (2) specify port range if (1) satisfied and (2) does not work then I will head to next step of troubleshooting
-
bhordupur almost 4 yearsin the next step i would add
nmap -p 1-65535 or nmap -p- meaning same
-
bhordupur almost 4 yearsand TigerVNC server on my Ubuntu server is running and you are not able to connect meaning something is blocking you. check your
iptables
what is blocked -
bhordupur almost 4 yearsWhat firewall are you using?
-
adazem009 almost 4 years@bhordupur I'm using ufw and it's disabled because I even can't connect to SSH when it's enabled.
-
adazem009 almost 4 yearsLet us continue this discussion in chat.
-
adazem009 almost 4 yearsEdit added above.
-
adazem009 almost 4 yearsI was running a VNC server on my previous server and it was working fine.
-
djangofan about 2 yearsI tried this change in my /etc/systemd/system/[email protected] file, and now my service will not start up. Not convinced this is the answer. I am using TightVNC, not Tiger.