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