Adding more users to a VNC Server

If you already have a VNC Server, then you will know how this works. We’re going to add another user to the VNC. It’s a very similar process to going through the initial installation process.

Go ahead and log in to your system and switch over to root… If you are not already signed in as root.

su -

Next well need to copy/paste a new vnc config file, like before.

cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:2.service

Since this is a different user, well need to use a different port. indicated by the “@:2”. The new port will be 5902.

Edit the config file.

vi /etc/systemd/system/vncserver@:2.service


# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
#ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
ExecStart=/sbin/runuser -l test-c "/usr/bin/vncserver %i"
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

After you have added the new user, go ahead and move over to the account.

su - test

Start vncserver


Once again, it will ask for a password. THis password is for when you are connecting to the server.

Finally, you will need to enter the following commands to enable/start the services.

systemctl daemon-reload
systemctl enable vncserver@:2.service

Restart your system and then log back in when the system is back online.

systemctl start vncserver@:2.service


You can also use this process to add Root to the VNC users.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s