Current location - Quotes Website - Collection of slogans - How does Linux modify VNC port number?
How does Linux modify VNC port number?
The default port of vnc is configured by itself, but there is no port number here.

By opening /etc/sysconfig/vncservers. There are two desktops configured here, one is 1 and the other is 2.

The parameters configured here

VNCSERVERS = " 2:root " VNCSERVERARGS[2]=-geometry 1280 x800 "

As you can see, there are two desktops configured here, one is 1 and the other is 2. There is also the resolution of the remote desktop.

To modify the configuration of vncserver, you must first find the configuration file path.

[root @ jtsyb01longgrise] # which vncserver /usr/bin/vncserver?

Then look at the type of this profile,

[root @ jtsyb01longrise] # file/usr/bin/vncserver/usr/bin/vncserver: a/usr/bin/envperl script text executable file.

Then the basic information you can learn is that you can use text files.

I configured port 80 here by looking up the previously configured port.

[root @ jtsyb 0 1 long rise]# grep " 80 "/usr/bin/vncserver-n 84:" xterm-geometry 80x 24+ 10+ 10-ls-title " $ VNCDESKTOP Desktop " & amp; n”。 222:$ VNC port = 800 1+$ display number; 4 19: If (! bind(S,pack('S n x 12 ',$AF_INET,800 1+$ n)){

You can see from the terminal that the previous port on my side was 800 1. By modifying vncport in line 222 and the number 800 1 in line 4 19, we can save the file after modification.

Restarting the vncserver service successfully modified the port number of vnc.

Finally, you can check the port status:

[root @ jtsyb 0 1 long rise]# PS-ef | grep VNC root 17 134 1 0 may 23? 00:13: 00/usr/bin/xvnc:1-desktop jtsyb01:1(longrise)-auth/root/. x authority-geometry 1024 x768-rfb wait 30000-rfb auth/root/。 Vnc/passwd -rfbport 8002 -fp directory:/etc/x11/fontpath.d-pn.

You can see that the port is running port 8002.