Detecting and Shutting Down VNC Server in CentOS-7


To list the ports and the Xvnc session’s associated user, as root, enter:

# lsof -i -P | grep vnc
Xvnc        2267     root    5u  IPv6    76766      0t0  TCP *:6003 (LISTEN)
Xvnc        2267     root    6u  IPv4    76767      0t0  TCP *:6003 (LISTEN)
Xvnc        2267     root    9u  IPv4    76775      0t0  TCP *:5903 (LISTEN)
Xvnc        2267     root   10u  IPv6    76776      0t0  TCP *:5903 (LISTEN)

Apparently, there is some Xvnc running. To do a quick shutdown

# systemctl |grep vnc
vncserver@:1.service                                                                             loaded active running   Remote desktop service (VNC)
  system-vncserver.slice                                                                           loaded active active    system-vncserver.slice
# systemctl stop vncserver@:1.servic
# systemctl stop system-vncserver.slice

Check that the XVNc again

# systemcl stop xvnc.socket
# systemctl status xvnc.socket
* xvnc.socket - XVNC Server
   Loaded: loaded (/usr/lib/systemd/system/xvnc.socket; disabled; vendor preset: disabled)
   Active: inactive (dead)
   Listen: [::]:5900 (Stream)
Accepted: 0; Connected: 0
# systemctl |grep vnc

If however, you are interested in setting up VNC, there is a good article for you to consider
Remote-desktop to a host using VNC¶

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.