Tiger vnc viewer linux

Содержание
  1. TigerVNC
  2. Contents
  3. Installation
  4. Running vncserver for virtual (headless) sessions
  5. Initial setup
  6. Starting and stopping tigervnc
  7. Expose the local display directly
  8. Running x0vncserver to directly control the local display
  9. Starting x0vncserver via xprofile
  10. Starting and stopping x0vncserver via systemd
  11. Running Xvnc with XDMCP for on demand sessions
  12. Connecting to vncserver
  13. Passwordless authentication
  14. Example GUI-based clients
  15. Accessing vncserver via SSH tunnels
  16. On the server
  17. On the client
  18. Connecting to a vncserver from Android devices over SSH
  19. Tips and tricks
  20. Connecting to an OSX system
  21. Recommended security settings
  22. Toggling fullscreen
  23. Workaround for mouse back and forward buttons not working
  24. Substituting mouse back/forward buttons with keyboard keys XF86Back/XF86Forward
  25. Mapping the keyboard key presses back to mouse button clicks on the server
  26. Troubleshooting
  27. Terminals in vncserver start in / (root dir)
  28. Unable to type ‘
  29. Black rectangle instead of window
  30. Empty black window with mouse cursor
  31. No mouse cursor
  32. Copying clipboard content from the remote machine
  33. «Authentication is required to create a color managed device» dialog when launching GNOME 3
  34. No window decoration / borders / titlebars / cannot move windows around
  35. systemd service unit run as user
  36. TigerVNC
  37. VNC Server
  38. Installing VNC Server
  39. Configuring VNC Server
  40. Configuring VNC Server for Two Users
  41. Starting VNC Server
  42. Configuring VNC Server for Two Users and Two Different Displays
  43. Terminating a VNC Session
  44. VNC Viewer
  45. Installing VNC Viewer
  46. Connecting to VNC Server
  47. Configuring the Firewall for VNC
  48. Connecting to VNC Server Using SSH
  49. Additional Resources

TigerVNC

TigerVNC is an implementation of the Virtual Network Computing (VNC) protocol. This article focuses on the server functionality.

Contents

Installation

Running vncserver for virtual (headless) sessions

Initial setup

For a quick start, see the steps below. Users are encouraged to read vncserver(8) for the complete list of configuration options.

    Create a password using vncpasswd which will store the hashed password in

/.vnc/passwd .

  • Edit /etc/tigervnc/vncserver.users to define user mappings. Each user defined in this file will have a corresponding port on which its session will run. The number in the file corresponds to a TCP port. By default, :1 is TCP port 5901 (5900+1). If another parallel server is needed, a second instance can then run on the next highest, free port, i.e 5902 (5900+2).
  • Create

    /.vnc/config and at a minimum, define the type of session desired with a line like session=foo where foo corresponds to whichever desktop environment is to run. One can see which desktop environments are available on the system by seeing their corresponding .desktop files within /usr/share/xsessions/ . For example:

    Starting and stopping tigervnc

    Start an instance of the vncserver@.service template and optionally enable it to run at boot time/shutdown. Note that the instance identifier in this case is the display number (e.g. instance vncserver@:1.service for display number :1 ).

    Expose the local display directly

    Tigervnc comes with libvnc.so which can be directly loaded during X initialization which provides better performance. Create a following file and restart X:

    Running x0vncserver to directly control the local display

    tigervnc also provides x0vncserver(1) which allows direct control over a physical X session. After defining a session password using the vncpasswd tool, invoke the server like so:

    Starting x0vncserver via xprofile

    A simple way to start x0vncserver is adding a line in one of the xprofile files such as:

    Starting and stopping x0vncserver via systemd

    In order to have a VNC Server running x0vncserver, which is the easiest way for most users to quickly have remote access to the current desktop, create a systemd unit as follows replacing the user and the options with the desired ones:

    Running Xvnc with XDMCP for on demand sessions

    One can use systemd socket activation in combination with XDMCP to automatically spawn VNC servers for each user who attempts to login, so there is no need to set up one server/port per user. This setup uses the display manager to authenticate users and login, so there is no need for VNC passwords. The downside is that users cannot leave a session running on the server and reconnect to it later.

    To get this running, first set up XDMCP and make sure the display manager is running. Then create:

    Use systemctl to start and enable xvnc.socket . Now any number of users can get unique desktops by connecting to port 5900.

    If the VNC server is exposed to the internet, add the -localhost option to Xvnc in xvnc@.service (note that -query localhost and -localhost are different switches) and follow #Accessing vncserver via SSH tunnels. Since we only select a user after connecting, the VNC server runs as user nobody and uses Xvnc directly instead of the vncserver script, so any options in

    /.vnc are ignored. Optionally, autostart vncconfig so that the clipboard works (vncconfig exits immediately in non-VNC sessions). One way is to create:

    Connecting to vncserver

    Any number of clients can connect to a vncserver. A simple example is given below where vncserver is running on 10.1.10.2 port 5901, or :1 in shorthand notation:

    Passwordless authentication

    The -passwd switch allows one to define the location of the server’s

    /.vnc/passwd file. It is expected that the user has access to this file on the server through SSH or through physical access. In either case, place that file on the client’s file system in a safe location, i.e. one that has read access ONLY to the expected user.

    Читайте также:  Переводчик экрана windows 10

    The password can also be provided directly.

    Example GUI-based clients

    TigerVNC’s vncviewer also has a simple GUI when run without any parameters:

    Accessing vncserver via SSH tunnels

    For servers offering SSH connection, an advantage of this method is that it is not necessary to open any other port than the already opened SSH port to the outside, since the VNC traffic is tunneled through the SSH port.

    On the server

    On the server side, vncserver or x0vncserver must be run.

    When running either one of these, it is recommended to use the localhost option in

    /.vnc/config or the -localhost switch (for x0vncserver) since it allows connections from the localhost only and by analogy, only from users ssh’ed and authenticated on the box. For example:

    Make sure to Start or Restart the vncserver@.service , for example (see also #Initial setup):

    or for x0vncserver:

    On the client

    The VNC server has been setup on the remote machine to only accept local connections. Now, the client must open a secure shell with the remote machine (10.1.10.2 in this example) and create a tunnel from the client port, for instance 9901, to the remote server 5901 port. For more details on this feature, see OpenSSH#Forwarding other ports and ssh(1) .

    Once connected via SSH, leave this shell window open since it is acting as the secured tunnel with the server. Alternatively, directly run SSH in the background using the -f option. On the client side, to connect via this encrypted tunnel, point the vncviewer to the forwarded client port on the localhost.

    What happens in practice is that the vncviewer connects locally to port 9901 which is tunneled to the server’s localhost port 5901. The connection is established to the right port within the secure shell.

    What it does is that the -f switch will make ssh go in the background, it will still be alive executing sleep 10 . vncviewer is then executed and ssh remains open in the background as long as vncviewer makes use of the tunnel. ssh will close once the tunnel is dropped which is the wanted behavior.

    Alternatively, vncviewer’s -via switch provides a shortcut for the above command:

    (Notice the double colon – vncviewer’s syntax is [host]:[display#] or [host]::[port] .)

    Connecting to a vncserver from Android devices over SSH

    To connect to a VNC server over SSH using an Android device as a client, consider having the following setup:

    1. SSH running on the server
    2. vncserver running on server (with -localhost flag for security)
    3. SSH client on the Android device: ConnectBot is a popular choice and will be used in this guide as an example
    4. VNC client on the Android device: androidVNC used here

    In ConnectBot, connect to the desired machine. Tap the options key, select Port Forwards and add a port:

    In androidVNC connect to the VNC port, this is the local address following the SSH connection:

    Tips and tricks

    Connecting to an OSX system

    If not #Accessing vncserver via SSH tunnels where the identification and the encryption are handled via SSH, it is recommended to use X509Vnc, as TLSVnc lacks identity verification.

    Issuing x509 certificates is beyond the scope of this guide. However, Let’s Encrypt provides an easy way to do so. Alternatively, one can issue certificates using OpenSSL, share the public key with the client and specify it with the -X509CA parameter. An example is given below the server is running on 10.1.10.2:

    Toggling fullscreen

    This can be done through vnc client’s menu. By default, vnc client’s mkey is F8 .

    Workaround for mouse back and forward buttons not working

    The VNC protocol currently only uses 7 mouse buttons (left, middle, right, scroll up, scroll down, scroll left, scroll right) which means if your mouse has a back and a forward button these are not usable and input will be ignored.

    evrouter can be used to work around this limitation by sending keyboard key presses when clicking the mouse back/forward buttons. Optionally xte found in xautomation and xbindkeys can be used on the server to map the keyboard key presses back to mouse button clicks if needed.

    Substituting mouse back/forward buttons with keyboard keys XF86Back/XF86Forward

    This method is simple and suitable if you only need a way to navigate backward/forward while using web browsers or file browsers for example.

    Install evrouter AUR and xautomation on the client. Configure evrouter, see Mouse buttons#evrouter and evrouter man pages for instructions and tips on how to find the correct device name, window name, button names etc. Example config:

    Start evrouter on the client. With above configuration keyboard key XF86Back is sent to the VNC server when clicking the back button on the mouse, and XF86Forward is sent when clicking the forward button.

    Читайте также:  Windows последняя версия рабочий стол

    Mapping the keyboard key presses back to mouse button clicks on the server

    If needed it’s possible to map the keyboard keys back to mouse button clicks on the server. In this case it might be a good idea to use keyboard keys which are never on the client or server. In the example below keyboard keys XF86Launch8/XF86Launch9 are used as mouse buttons 8/9.

    Evrouter configuration on the client:

    Install xautomation and xbindkeys on the server. Configure xbindkeys to map keyboard keys XF86Launch8/XF86Launch9 to mouse buttons 8/9 with xte.

    Start xbindkeys $ xbindkeys -f

    /.xbindkeysrc . The server will now map XF86Launch8/XF86Launch9 to mouse buttons 8/9.

    Troubleshooting

    Terminals in vncserver start in / (root dir)

    Unable to type ‘

    If pressing on a remote client emits the > character, try remapping the incoming key [1] [dead link 2020-04-03 ⓘ] :

    Black rectangle instead of window

    Most probably this is due to the application strictly requiring the composite Xorg extension. For example webkit based app: midori, psi-plus, etc.

    Restart vncserver in this case using something like following:

    It looks like Composite extension in VNC will work only with 24bit depth.

    Empty black window with mouse cursor

    Verify that the user is not logged into a physical X session, unless this option was configured with x0vncserver . Multiple X sessions for a single user are not supported, see https://github.com/TigerVNC/tigervnc/issues/684#issuecomment-494385395.

    Conversely, trying to log into a local X session while a VNC server service is running for that user will likely not work, and you may get stuck on a splash screen when using a desktop environment.

    No mouse cursor

    If no mouse cursor is visible when using x0vncserver, start vncviewer as follows:

    Alternatively, put DotWhenNoCursor=1 in the TigerVNC configuration file, which is at

    /.vnc/default.tigervnc by default.

    Copying clipboard content from the remote machine

    If copying from the remote machine to the local machine does not work, run autocutsel on the server, as mentioned in [2]:

    Now press F8 to display the VNC menu popup, and select Clipboard: local -> remote option.

    «Authentication is required to create a color managed device» dialog when launching GNOME 3

    A workaround is to create a «vnc» group and add the gdm user and any other users using vnc to that group. Modify /etc/polkit-1/rules.d/gnome-vnc.rules with the following[3]:

    No window decoration / borders / titlebars / cannot move windows around

    Start a window manager to fix an empty xterm frame. For example, on Xfce, run xfwm4 & .

    systemd service unit run as user

    Create the following template:

    Start/enable tigervnc@:9 to run the template instance on display 9.

    Источник

    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 :

    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.

    Источник

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