|
|
6952aa |
# What has changed
|
|
|
6952aa |
The previous Tigervnc versions had a wrapper script called `vncserver` which
|
|
|
6952aa |
could be run as a user manually to start *Xvnc* process. The usage was quite
|
|
|
6952aa |
simple as you just run
|
|
|
6952aa |
```
|
|
|
6952aa |
$ vncserver :x [vncserver options] [Xvnc options]
|
|
|
6952aa |
```
|
|
|
6952aa |
and that was it. While this was working just fine, there were issues when users
|
|
|
6952aa |
wanted to start a Tigervnc server using *systemd*. For these reasons things were
|
|
|
6952aa |
completely changed and there is now a new way how this all is supposed to work.
|
|
|
6952aa |
|
|
|
6952aa |
# How to start Tigervnc server
|
|
|
6952aa |
|
|
|
6952aa |
## Add a user mapping
|
|
|
6952aa |
With this you can map a user to a particular port. The mapping should be done in
|
|
|
6952aa |
`/etc/tigervnc/vncserver.users` configuration file. It should be pretty
|
|
|
6952aa |
straightforward once you open the file as there are some examples, but basically
|
|
|
6952aa |
the mapping is in form
|
|
|
6952aa |
```
|
|
|
6952aa |
:x=user
|
|
|
6952aa |
```
|
|
|
6952aa |
For example you can have
|
|
|
6952aa |
```
|
|
|
6952aa |
:1=test
|
|
|
6952aa |
:2=vncuser
|
|
|
6952aa |
```
|
|
|
6952aa |
|
|
|
6952aa |
## Configure Xvnc options
|
|
|
6952aa |
To configure Xvnc parameters, you need to go to the same directory where you did
|
|
|
6952aa |
the user mapping and open `vncserver-config-defaults` configuration file. This
|
|
|
6952aa |
file is for the default Xvnc configuration and will be applied to every user
|
|
|
6952aa |
unless any of the following applies:
|
|
|
6952aa |
* The user has its own configuration in `$HOME/.vnc/config`
|
|
|
6952aa |
* The same option with different value is configured in
|
|
|
6952aa |
`vncserver-config-mandatory` configuration file, which replaces the default
|
|
|
6952aa |
configuration and has even a higher priority than the per-user configuration.
|
|
|
6952aa |
This option is for system administrators when they want to force particular
|
|
|
6952aa |
*Xvnc* options.
|
|
|
6952aa |
|
|
|
6952aa |
Format of the configuration file is also quite simple as the configuration is
|
|
|
6952aa |
in form of
|
|
|
6952aa |
```
|
|
|
6952aa |
option=value
|
|
|
6952aa |
option
|
|
|
6952aa |
```
|
|
|
6952aa |
for example
|
|
|
6952aa |
```
|
|
|
6952aa |
session=gnome
|
|
|
6952aa |
securitytypes=vncauth,tlsvnc
|
|
|
6952aa |
desktop=sandbox
|
|
|
6952aa |
geometry=2000x1200
|
|
|
6952aa |
localhost
|
|
|
6952aa |
alwaysshared
|
|
|
6952aa |
```
|
|
|
6952aa |
### Note:
|
|
|
6952aa |
There is one important option you need to set and that option is the session you
|
|
|
6952aa |
want to start. E.g when you want to start GNOME desktop, then you have to use
|
|
|
6952aa |
```
|
|
|
6952aa |
session=gnome
|
|
|
6952aa |
```
|
|
|
6952aa |
which should match the name of a session desktop file from `/usr/share/xsessions`
|
|
|
6952aa |
directory.
|
|
|
6952aa |
|
|
|
6952aa |
## Set VNC password
|
|
|
6952aa |
You need to set a password for each user in order to be able to start the
|
|
|
6952aa |
Tigervnc server. In order to create a password, you just run
|
|
|
6952aa |
```
|
|
|
6952aa |
$ vncpasswd
|
|
|
6952aa |
```
|
|
|
6952aa |
as the user you will be starting the server for.
|
|
|
6952aa |
### Note:
|
|
|
6952aa |
If you were using Tigervnc before for your user and you already created a
|
|
|
6952aa |
password, then you will have to make sure the `$HOME/.vnc` folder created by
|
|
|
6952aa |
`vncpasswd` will have the correct *SELinux* context. You either can delete this
|
|
|
6952aa |
folder and recreate it again by creating the password one more time, or
|
|
|
6952aa |
alternatively you can run
|
|
|
6952aa |
```
|
|
|
6952aa |
$ restorecon -RFv /home/<USER>/.vnc
|
|
|
6952aa |
```
|
|
|
6952aa |
|
|
|
6952aa |
## Start the Tigervnc server
|
|
|
6952aa |
Finally you can start the server using systemd service. To do so just run
|
|
|
6952aa |
```
|
|
|
6952aa |
$ systemctl start vncserver@:x
|
|
|
6952aa |
```
|
|
|
6952aa |
as root or
|
|
|
6952aa |
```
|
|
|
6952aa |
$ sudo systemctl start vncserver@:x
|
|
|
6952aa |
```
|
|
|
6952aa |
as a regular user in case it has permissions to run `sudo`. Don't forget to
|
|
|
6952aa |
replace the `:x` by the actual number you configured in the user mapping file.
|
|
|
6952aa |
Following our example by running
|
|
|
6952aa |
```
|
|
|
6952aa |
$ systemctl start vncserver@:1
|
|
|
6952aa |
```
|
|
|
6952aa |
you will start a Tigervnc server for user `test` with a GNOME session.
|
|
|
6952aa |
|
|
|
6952aa |
### Note:
|
|
|
6952aa |
If you were previously using Tigervnc and you were used to start it using
|
|
|
6952aa |
*systemd* then you will need to remove previous *systemd* configuration files,
|
|
|
6952aa |
those you most likely copied to `/etc/systemd/system/vncserver@.service`,
|
|
|
6952aa |
otherwise this service file will be preferred over the new one installed with
|
|
|
6952aa |
latest Tigervnc.
|
|
|
6952aa |
|
|
|
6952aa |
# Limitations
|
|
|
6952aa |
You will not be able to start a Tigervnc server for a user who is already
|
|
|
6952aa |
logged into a graphical session. Avoid running the server as the `root` user as
|
|
|
6952aa |
it's not a safe thing to do. While running the server as the `root` should work
|
|
|
6952aa |
in general, it's not recommended to do so and there might be some things which
|
|
|
6952aa |
are not working properly.
|