Here you have to enter a password and then confirm again. This password will be needed later for the VNC client on the remote machine. It is self-selectable and has nothing to do with the user password. It is the VNC server password.
The demand for a read only password can be denied.<\/p>\n\n\n\n
\nvncserver: 1\n<\/pre><\/div>\n\n\nThen you can connect to Raspberry Pi with a VNC client. Please note that besides the hostname or the IP address of the Raspberry Pi you also have to specify port 5901 (eg 192.168.1.2:5901).<\/p>\n\n\n\n
Note: The parameter “: 1” refers to the first virtual desktop. He has the port “5901”. If you want to operate more virtual desktops via VNC, then increase to “: 2”, etc. and select accordingly the port “5902” etc.<\/p>\n\n\n\n
Parameters of TightVNCServer<\/strong>
Command to start a VNC session with additional parameters (optional):<\/p>\n\n\n\nvncserver: 1 -geometry 1920x1080 -depth 16 -name raspi -localhost\n<\/pre><\/div>\n\n\nCommand to end the VNC session:<\/p>\n\n\n
\nvncserver: 1 -kill\n<\/pre><\/div>\n\n\n–geometry<\/strong>: This parameter specifies the resolution of the desktop to be transmitted to the VNC client. In principle, one can specify any values here. But make sense only resolutions that can be displayed on the client. If the values are too large, then parts of the desktop are obscured and then you have to scroll in the window of the VNC client.
If you want to work on the VNC client with full screen, then you have to enter the resolution of the client here. But, the higher the resolution, the larger the volume of data to be transferred. That’s certainly not a problem on the local network. When transferring over the Internet already.<\/p>\n\n\n\n-depth<\/strong>: This parameter sets the color depth in bits of the images to be transferred. The best, color-detailed representation is obtained with the values of 24 or 32. However, this requires a correspondingly high bandwidth or transmission speed in order to be able to transmit the resulting data volume. As a rule, this can only be achieved in the local network. A value of 16 is certainly acceptable. A value of 8 is the minimum. The lower the value, the lower the data volume and the higher the bandwidth required.<\/p>\n\n\n\n-name<\/strong>: This parameter specifies the name to be displayed in the VNC client. This is interesting if you work with several VNC sessions on different systems and want to differentiate between the windows.<\/p>\n\n\n\n-localhost<\/strong>: This parameter prevents the VNC session from being established over the Internet in an unsecured manner. The idea here is to first establish a secure SSH connection and run the VNC session over it.<\/p>\n\n\n\n-kill<\/strong>: With this parameter you can end the VNC session.<\/p>\n\n\n\nExtension: VNC server autostart on the desktop<\/strong>
If you want to start the VNC server automatically when booting Raspberry Pis, then you have to create an autostart file.<\/p>\n\n\n\nnano \/home\/pi\/.config\/autostart\/tightvnc.desktop\n<\/pre><\/div>\n\n\nIn this file we add the following lines:<\/p>\n\n\n
\n[Desktop Entry]\nType = Application\nName = TightVNC\nExec = vncserver: 1\nStartupNotify = false\n<\/pre><\/div>\n\n\nThen save and close the file: Ctrl + O, Return, Ctrl + X.<\/p>\n\n\n\n
Now you have to restart Raspberry Pi once.<\/p>\n\n\n
\nsudo reboot\n<\/pre><\/div>\n\n\nAfterwards, if the desktop was started, also a VNC connection to Raspberry Pi should be possible.<\/p>\n\n\n\n
Extension: Startup of TightVNCServer via systemd service<\/strong>
There is a second option to automatically start the TightVNCServer at boot time. And not via the autostart settings of the graphical desktop, but via a systemd service. This second variant has the advantage that you can control it a little finer, as long as you trust the command line.<\/p>\n\n\n\nFirst we create a new file in the systemd system directory:<\/p>\n\n\n