Troubleshoot refused VNC Connection in CentOS 7

Source: Internet
Author: User

Troubleshoot refused VNC Connection in CentOS 7Posted on March Istvan szarka -2 Comments

The other day I connected to my CentOS 7 computer from Windows via RealVNC Viewer. Everything went fine, but after I left the machines unattended for a short time, the connection froze Had to shut CentOS down and boot it again. When I tried to connect again, I got a error message saying something like "The connection is refused by the host Co Mputer " or similar, I can ' t remember exactly. I rebooted CentOS several times, but nothing changed. Now I had to connect a monitor and the necessary peripherals to the box and start troubleshooting.

First, I checked the status of the VNC service:

[Email protected] desktop]# systemctl status [email protected]:2.service-l[email protected]:2.service-remote Desktop s Ervice (VNC)   loaded:loaded (/etc/systemd/system/[email protected]:2.service; enabled)   active:failed (Result : Exit-code) since Sat 2015-02-28 14:37:00 CET; 10min agofeb 14:37:00 Localhost.localdomain systemd[1]: [email Protected]:2.service:control process exited, code=exit Ed Status=2feb 14:37:00 Localhost.localdomain systemd[1]: Failed to start Remote Desktop Service (VNC). Feb 14:37:00 localhost.localdomain systemd[1]: Unit [email Protected]:2.service entered failed state.

The VNC service apparently failed to start. If you don ' t know why I used [email protected]:2.service , please read my earlier post about configuring VNC. I tried to start the service, but it kept failing:

[Email protected] desktop]# systemctl start [email protected]:2.servicejob for [email Protected]:2.service failed. See ' systemctl status [e-mail Protected]:2.service ' and ' journalctl-xn ' for details.

As I was digging through the internet, I found some clues about corrupted session files that had to being deleted to solve th is problem. The files were supposed /tmp/.X11-unix to being in the directory (capital X11, Linux is case-sensitive!). When I checked the contents of/tmp, I found this:

There was no /.X11-unix directory inside. The issue was, that's this folder is hidden and such items can have only been seen if you put after, like this -la ls :

Now I saw the folder I am looking for at the end of the list. Inside /.X11-unix were the session files:

The corrupted file belonging to "Vncuser", the user I configured for VNC access, was X2. I removed it rm /tmp/.X11-unix/X2 with the command. Then, I started the service, rebooted the computer and I were able to seamlessly connect to my CentOS machine through VNC.

Troubleshoot refused VNC Connection in CentOS 7

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.