Tigervnc server linux fedora

TigerVNC

TigerVNC (Tiger Virtual Network Computing) is a system for graphical desktop sharing which allows you to remotely control other computers.

TigerVNC works on the client-server network: a server shares its output ( vncserver ) and a client ( vncviewer ) connects to the server.

Unlike in Fedora 15 and Red Hat Enterprise Linux 6, TigerVNC in Fedora uses the systemd system management daemon for its configuration. The /etc/sysconfig/vncserver configuration file has been replaced by /etc/systemd/system/vncserver@.service .

VNC Server

vncserver is a utility which starts a VNC (Virtual Network Computing) desktop. It runs Xvnc with appropriate options and starts a window manager on the VNC desktop. vncserver allows users to run separate sessions in parallel on a machine which can then be accessed by any number of clients from anywhere.

Installing VNC Server

To install the TigerVNC server, issue the following command as root :

Configuring VNC Server

A configuration file named /etc/systemd/system/vncserver@.service is required. To create this file, copy the /lib/systemd/system/vncserver@.service file as root :

There is no need to include the display number in the file name because systemd automatically creates the appropriately named instance in memory on demand, replacing ‘%i’ in the service file by the display number. For a single user it is not necessary to rename the file. For multiple users, a uniquely named service file for each user is required, for example, by adding the user name to the file name in some way. See Configuring VNC Server for Two Users for details.

Edit /etc/systemd/system/vncserver@.service , replacing USER with the actual user name. Leave the remaining lines of the file unmodified. The -geometry argument specifies the size of the VNC desktop to be created; by default, it is set to 1024×768 .

Save the changes.

To make the changes take effect immediately, issue the following command:

Set the password for the user or users defined in the configuration file. Note that you need to switch from root to USER first.

The stored password is not encrypted; anyone who has access to the password file can find the plain-text password.

Configuring VNC Server for Two Users

If you want to configure more than one user on the same machine, create different template-type service files, one for each user.

Create two service files, for example vncserver-USER_1@.service and vncserver-USER_2@.service . In both these files substitute USER with the correct user name.

Set passwords for both users:

Starting VNC Server

To start or enable the service, specify the display number directly in the command. The file configured above in Configuring the first VNC connection works as a template, in which %i is substituted with the display number by systemd . With a valid display number, execute the following command:

You can also enable the service to start automatically at system start. Then, when you log in, vncserver is automatically started. As root , issue a command as follows:

At this point, other users are able to use a VNC viewer program to connect to the VNC server using the display number and password defined. Provided a graphical desktop is installed, an instance of that desktop will be displayed. It will not be the same instance as that currently displayed on the target machine.

Configuring VNC Server for Two Users and Two Different Displays

For the two configured VNC servers, vncserver-USER_1@.service and vncserver-USER_2@.service, you can enable different display numbers. For example, the following commands will cause a VNC server for USER_1 to start on display 3, and a VNC server for USER_2 to start on display 5:

Terminating a VNC Session

Similarly to enabling the vncserver service, you can disable the automatic start of the service at system start:

Or, when your system is running, you can stop the service by issuing the following command as root :

Читайте также:  Последняя версия защитника windows

VNC Viewer

vncviewer is the program which shows the shared graphical user interfaces and controls the server.

For operating the vncviewer , there is a pop-up menu containing entries which perform various actions such as switching in and out of full-screen mode or quitting the viewer. Alternatively, you can operate vncviewer through the terminal. Enter vncviewer -h on the command line to list vncviewer ‘s parameters.

Installing VNC Viewer

To install the TigerVNC client, vncviewer >, issue the following command as root :

Connecting to VNC Server

Once the VNC server is configured, you can connect to it from any VNC viewer. In order to do so, issue the vncviewer command in the following format:

Where address is an IP or host name.

With the IP address 192.168.0.4 and display number 3 the command looks as follows:

Configuring the Firewall for VNC

When using a non-encrypted connection, firewalld might block the connection. To allow firewalld to pass the VNC packets, you can open specific ports to TCP traffic. When using the -via option, traffic is redirected over SSH which is enabled by default in firewalld .

The default port of VNC server is 5900. To reach the port through which a remote desktop will be accessible, sum the default port and the user’s assigned display number. For example, for the second port: 2 + 5900 = 5902.

For displays 0 to 3 , make use of firewalld ‘s support for the VNC service by means of the service option as described below. Note that for display numbers greater than 3 , the corresponding ports will have to be opened specifically as explained in Opening Ports in firewalld.

Run the following command to see the information concerning firewalld settings:

To allow all VNC connections from a specific address, use a command as follows:

See the Red Hat Enterprise Linux 7 Security Guide for more information on the use of firewall rich language commands.

To verify the above settings, use a command as follows:

To open a specific port or range of ports make use of the —add-port option to the firewall-cmd command Line tool. For example, VNC display 4 requires port 5904 to be opened for TCP traffic.

To open a port for TCP traffic in the public zone, issue a command as root as follows:

To view the ports that are currently open for the public zone, issue a command as follows:

A port can be removed using the firewall-cmd —zone=zone —remove-port=number/protocol command.

For more information on opening and closing ports in firewalld , see the Red Hat Enterprise Linux 7 Security Guide.

Connecting to VNC Server Using SSH

VNC is a clear text network protocol with no security against possible attacks on the communication. To make the communication secure, you can encrypt your server-client connection by using the -via option. This will create an SSH tunnel between the VNC server and the client.

The format of the command to encrypt a VNC server-client connection is as follows:

To connect to a VNC server using SSH , enter a command as follows:

When you are prompted to, type the password, and confirm by pressing Enter .

A window with a remote desktop appears on your screen.

If you prefer only encrypted connections, you can prevent unencrypted connections altogether by using the -localhost option in the systemd.service file, the ExecStart line:

This will stop vncserver from accepting connections from anything but the local host and port-forwarded connections sent using SSH as a result of the -via option.

For more information on using SSH , see OpenSSH.

Additional Resources

For more information about TigerVNC, see the resources listed below.

vncserver(1) — The VNC server manual pages.

vncviewer(1) — The VNC viewer manual pages.

vncpasswd(1) — The VNC password manual pages.

All Fedora Documentation content available under CC BY-SA 4.0 or, when specifically noted, under another accepted free and open content license.

Источник

Installing Using VNC

The graphical installation interface is the recommended method of installing Fedora. However, in some cases, accessing the graphical interface directly is difficult or impossible. Some systems lack the capability to connect a display and a keyboard, making VNC a necessity for manual (non-Kickstart) installations.

To allow manual installations on headless systems (systems without a directly connected display, keyboard and mouse), the Anaconda installation program includes a Virtual Network Computing (VNC) mode which allows the graphical mode of the installation program to run locally, but display on another system connected to the network. The VNC installation provides you with the full range of installation options.

Читайте также:  Linux file system encryption

This chapter provides instructions on activating VNC mode on the installation system and connecting to it using a VNC viewer.

Installing a VNC Viewer

Performing a VNC installation requires a VNC viewer running on your workstation or another terminal computer. VNC viewers are available in the repositories of most Linux distributions; free VNC viewers are also available for other operating systems such as Windows. On Linux systems, use your package manager to search for a viewer for your distribution.

The following VNC viewers are available in Fedora:

TigerVNC — A basic viewer independent of your desktop environment. Installed as the tigervnc package.

Vinagre — A viewer for the GNOME desktop environment. Installed as the vinagre package.

KRDC — A viewer integrated with the KDE desktop environment. Installed as the kdenetwork-krdc package.

To install any of the viewers listed above, execute the following command as root :

Replace package with the package name of the viewer you want to use (for example, tigervnc).

Procedures in this chapter assume you are using TigerVNC as your VNC viewer. Specific instructions for other viewers may differ, but the general principles still apply.

Performing a VNC Installation

The Anaconda installation program offers two modes for VNC installation: Direct mode and Connect mode. The modes differ in the way the connection between the server and viewer is established. After you successfully connect, the installation will progress the same way regardless of the mode you used.

In this mode, Anaconda is configured to start the installation and wait for an incoming connection from VNC viewer before proceeding. While waiting for an incoming connection, the system’s IP address and the port on which the installer expects the connection is displayed on the display or console if available; this implies that you need at least a serial console to connect using this mode, but you can work around this limitation if you know the default VNC port and the system’s IP address.

In this mode, the VNC viewer is started on the remote system in listening mode. The VNC viewer waits for an incoming connection on a specified port. Then, Anaconda is started and the host name/IP address and port number of the viewer are provided using a boot option or a Kickstart command. When the installation begins, the installation program establishes a connection with the listening VNC viewer using the specified host name/IP address and port number. Connect mode is therefore easier to use on systems with no local display or console, but it also may require additional preparation, because the viewer system must be able to accept incoming connections on the specified port, which usually requires changing firewall settings.

Choosing a VNC Installation Mode

Visual and Interactive access to the system

If visual and interactive access to the system being installed is not available, then you should use Connect Mode.

Network Connection Rules and Firewalls

If the system being installed is not allowed inbound connections by a firewall, then you must use Connect Mode or disable the firewall. Disabling a firewall may have security implications.

If the remote system running the VNC viewer is not allowed incoming connections by a firewall, then you must use Direct Mode, or disable the firewall. Disabling a firewall may have security implications.

Installing in VNC Direct Mode

VNC Direct Mode is when the VNC viewer initiates a connection to the system being installed. Anaconda will tell you when to initiate this connection.

Open the VNC viewer (for example, TigerVNC) on the workstation you will be using to connect to the system being installed. A window similar to TigerVNC Connection Details will be displayed with an input field allowing you to specify an IP address.

Boot the installation system and wait for the boot menu to appear. In the menu, edit boot options (see The Boot Menu) and append the inst.vnc option to the end of the command line.

Optionally, if you want to restrict VNC access to the installation system, add the inst.vncpassword=PASSWORD boot option as well. Replace PASSWORD with the password you want to use for the installation. The VNC password must be between 6 and 8 characters long.

Читайте также:  Не запускать windows media center

Use a temporary password for the inst.vncpassword= option. It should not be a real or root password you use on any system.

Start the installation using the edited options. The system will initialize the installation program and start the necessary services. When the system is ready, you will see a message on the screen similar to the following:

Note the IP address and port number (in the above example, 192.168.100.131:5901 ).

On the system running the VNC Viewer, enter the IP address and port number obtained in the previous step into the Connection Details dialog in the same format as it was displayed on the screen by the installer. Then, click Connect . The VNC viewer will now connect to the installation system. If you set up a VNC password, enter it when prompted and press OK .

When the connection is successfully established, a new window will open on the system running the VNC viewer, displaying the installation menu. This window will provide full remote access to the installer until the installation finishes and the system reboots for the first time.

Installing in VNC Connect Mode

VNC connect mode is when the system being installed initiates a connection to the VNC viewer running on a remote system. Before you start, make sure the remote system is configured to accept incoming connection on the port you want to use for VNC. The exact way to make sure the connection will not be blocked depends on your network and on your workstation’s configuration. Information about configuring the firewall in Fedora is available in the Fedora Security Guide, available at https://docs.fedoraproject.org/.

Start the VNC viewer on the client system in listening mode. For example, on Fedora using TigerVNC, execute the following command:

Replace PORT with the port number you want to use for the connection.

The terminal will display a message similar to the following example:

When this message is displayed, the VNC viewer is ready and waiting for an incoming connection from the installation system.

Boot the installation system and wait for the boot menu to appear. In the menu, edit boot options (see The Boot Menu) and append the following options to the end of the command line:

Replace HOST with the IP address of the system running the listening VNC viewer, and PORT with the port number that the VNC viewer is listening on.

Start the installation. The system will initialize the installation program and start the necessary services. Once the initialization is finished, Anaconda will attempt to connect to the IP address and port you provided in the previous step.

When the connection is successfully established, a new window will open on the system running the VNC viewer, displaying the installation menu. This window will provide full remote access to the installer until the installation finishes and the system reboots for the first time.

Kickstart Considerations

Commands for using a VNC installation are also available in Kickstart installations. Using just the vnc command will set up an installation using Direct Mode. Options are available to set up an installation using Connect Mode. For more information about the vnc command and options used in Kickstart files, see Kickstart Syntax Reference.

Considerations for Headless Systems

When installing headless systems, the only choices are an automated Kickstart installation or an interactive VNC installation using connect mode. For more information about automated Kickstart installation, see Kickstart Syntax Reference. The general process for an interactive VNC installation is described below.

Set up a PXE server that will be used to start the installation. Information about installing and performing basic configurating of a PXE server can be found in Setting Up an Installation Server.

Configure the PXE server to use the boot options for a connect mode VNC installation. For information on these boot options, see Installing in VNC Connect Mode.

Follow the procedure for a VNC Installation using connect mode as described in the Starting VNC in Connect Mode. However, when directed to boot the system, boot it from the PXE server.

All Fedora Documentation content available under CC BY-SA 4.0 or, when specifically noted, under another accepted free and open content license.

Источник

Оцените статью