Wednesday, October 10, 2018

Linux Mint Install VNC server

1. Disable firewall
sudo ufw disable
sudo apt-get -y remove vino

2. removing the default Vino server (desktop sharing) in Linux Mint

sudo apt-get -y install x11vnc


3.  create a directory to store a file that will contain the password used for VNC authentication:
sudo mkdir /etc/x11vnc

4. create an encrypted password file and save it in /etc/x11vnc/. You will be prompted to type and verify the password:

sudo x11vnc --storepasswd /etc/x11vnc/vncpwd
VNC Server encrypted password file

5. create the systemd service file for the x11vnc service:

sudo xed /lib/systemd/system/x11vnc.service
Copy & paste the code below into xed:

[Unit]
Description=VNC Server for X11
Requires=display-manager.service
After=display-manager.service
[Service]
Type=forking
ExecStart=/usr/bin/x11vnc -dontdisconnect -auth guess -forever -shared -noxdamage -repeat -rfbauth /etc/x11vnc/vncpwd -rfbport 5900 -bg -o /var/log/x11vnc.log
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
Restart-sec=5

[Install]
WantedBy=multi-user.target

Save and close the file. Then copy /lib/systemd/system/x11vnc.service to /etc/systemd/system/

6. edit /lib/systemd/system/graphical.target

sudo xed /lib/systemd/system/graphical.target
Edit graphical.target file as following:

# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Graphical Interface
Documentation=man:systemd.special(7)
Requires=multi-user.target
Wants=display-manager.service x11vnc.service
Conflicts=rescue.service rescue.target
After=multi-user.target rescue.service rescue.target display-manager.service
AllowIsolate=yes

Save and close the file. Then copy /lib/systemd/system/graphical.target to /etc/systemd/system/
sudo cp /lib/systemd/system/graphical.target /etc/systemd/system/


7. Reload services and enable the x11vnc service at boot time:

sudo systemctl daemon-reload
sudo systemctl enable graphical.target

8. reboot (preferably) Linux Mint or manually start x11vnc service:

sudo systemctl start x11vnc.service


Remotely controlling Linux Mint 18.x
From a client computer in your network, using a VNC client of your choice (Remmina, Ultra VNC, TightVNC, Chicken VNC, VNC Viewer, Screen Sharing, (you name it) enter the IP address of your Linux Mint box or its hostname