VNC usage and solutions to common problems


The blogger was in the blog before( configuration method of multi person VNC has been introduced in. The following will briefly introduce its usage and solutions to common problems.

VNC use

Open VNC port

The steps to open VNC port are as follows:

Step 1:Open mobaxterm software, log in to the server and enter the background:

Step 2:Enter the VNC port service start command:

Vnc4server: port number

When the content shown in the above figure appears, it indicates that the port is normally opened.

Log in to VNC remote desktop

Login steps are as follows:

Step 1:Open VNC viewer, enter the host: port number, and then click OK to enter the password interface.

Step 2:Enter the password and click OK to enter the remote desktop.

Creating virtual machines through VNC

Step 1:Open the mobaxterm software, enter the KVM server, and create a new “image file directory”. Of course, you can also choose other folders by yourself.

Step 2:Click the upload file button, select the local KVM image file, and then click open to start uploading.

Step 3:Return to VNC remote desktop and click the button at the bottom of the screen, select all applications and enter “vir” in the search box to jump out of the virtual machine manager, and then click start to open the virtual system manager.

Step 4:Click the button, select import an existing disk image, and then click forward.

Step 5:Click Browse to find the local image file, and then click forward.

Step 6:Set memory and CPU.

Step 7:Name the virtual machine, then select network (optional), and finish.

 Step 8: wait until the installation is completed. When the following screen appears, turn it off.

Step 9:Click the virtual machine details button, find the display protocol, select VNC server and key mapping, then click apply, and then click startReboot.

Step 10:Click add hardware to add working interface.

Solutions to common problems of VNC

VNC port problem

(1)Connection refused

For example, when VNC is connected from port 1,The following error message may appear: unable to connect to host: connection rejected (10061)

Log in to the server terminal to view:

vnc4server :1

A VNC server is already running as: 1

Note that in the previous Waring, the contents in the red box in the figure need to be deleted:

rm -rf /tmp/.X11-unix/X1

Then re open the port:

If the content shown in the above figure appears, it means that the port has been opened successfully. Just log in to VNC again.

There is another similar situation above:

Delete the contents in the red box in the figure:

rm -rf /tmp/.X32-lock

Restart the port after deletion:

The path of the first case will appear. At this time, you need to continue to delete this kind of file:

rm -rf /tmp/.X11-unix/X32

Then restart and start the port normally.

(2) VNC creation permission problem

When creating port 3, the situation shown in the red box below appears. Although it can be created successfully, when you log in from VNC, you will find that the background is dark. Except for a fork mouse, the reason is that there is a problem with the startup file permissions of the newly created VNC port.


Kill the VNC service process just started:

vnc4server -kill :3

Then restart the VNC port service. If the problem still occurs when restarting the VNC service, it indicates that the VNC startup file still fails

Solution: open the startup file (no editing is required) and enter the following command:

sudo vi /root/.vnc/xstartup

Then click ESC – > Q – > Enter to exit file editing and restart the VNC port service,The startup is successful when the following contents appear:

(3) VNC network problems

Do not disconnect the network manually when using VNC remote desktop, otherwise all users will be disconnected and can only use the display to connect to the server.

When the monitor is connected to the server for login, the problem of login dead cycle may occur,You can enter the tty2 terminal through Ctrl + Alt + F2, enter the user name and password, and enter the following commands:

cd ~
   sudo chown nsfocus:nsfocus .Xauthority

View the file after success:

ls .Xauthority -l

Press Ctrl + Alt + F1 to return to the graphical interface and log in again. If not, restart login.

If the above operation is invalid, the temporary network can be configured through tty2 terminal, and then the network can be started through VNC remote login desktop.

VNC remote virtual machine keyboard problem

When you enter KVM virtual machine operation through VNC remote connection server, the keyboard cannot be operated. Solution:

To open the virtual machine, you need to modify the display protocol VNC:

① Select VNC server as the type;

② The selection key is mapped to en US

Recommended Today

Agent ARP of HCNP Routing & Switching

Previously, we learned about the topics related to port isolation. For review, please refer to; Today, let’s talk about ARP agent related topics; The solution of port isolation As we can see from the packet capture above, when the ports under the same VLAN are isolated by two-way ports or one-way ports, the corresponding ports […]