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