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