I have followed all the steps described in How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7.
I am able to start the vncserver service
[root@server ~]# systemctl start vncserver@:1.service
[root@server ~]# systemctl status vncserver@:1.service
● vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2016-11-12 01:40:25 EET; 5s ago
Process: 32470 ExecStop=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Process: 3023 ExecStart=/usr/sbin/runuser -l user -c /usr/bin/vncserver %i -geometry 1280x1024 (code=exited, status=0/SUCCESS)
Process: 3004 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Main PID: 3070 (Xvnc)
CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
‣ 3070 /usr/bin/Xvnc :1 -desktop server:1 (user) -auth /home/user/.Xauthority -geometry 1280x1024 -rfbwait 30000 -rfbauth /home/user/.vnc...
Nov 12 01:40:22 server systemd[1]: Starting Remote desktop service (VNC)...
Nov 12 01:40:25 server systemd[1]: Started Remote desktop service (VNC).
I deleted all iptables rules
[root@server ~]# iptables -nvL
Chain INPUT (policy ACCEPT 2710 packets, 297K bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 2515 packets, 478K bytes)
pkts bytes target prot opt in out source destination
Firewall is disabled
[root@server ~]# firewall-cmd --state
not running
Port 5901 is open and listening
[root@server ~]# netstat -tpln | grep "5901"
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 3070/Xvnc
tcp6 0 0 :::5901 :::* LISTEN 3070/Xvnc
I also have the socket file /tmp/.X11-unix/X1
But when I try to connect through vncviewer using IP:5901 I get the same error "The connection was refused by the host computer".
I have multiple servers running this same configuration and everything works fine but all of them were configured after installation, unlike this one which has been running for quite some time. The server is running CentOS 7. Is there anything I can do without physical access to it (no wiping all data/reinstalling the OS) in order to make it work?