28-05-2022, 11:36 AM
Okay here is VNC, it is not going to be pretty and at one point I was ready to blow linux away and install Win 10 in its place, yep the air around me was B-L-U-E with nasty words.
After a great deal of searching and failure I found this forum post... YES an answer on a forum, who would have thought that.
While his english syntax is not that great the actual code you need to run is all outlined here: VNC Install So just in case his posting disappears, I will try and transfer the steps to here. This is all done in a terminal window (Console view)
Install the basic VNC software:
Update the packages
Start the VNC server for the first time
At this point you can connect to the computer via VNC without a password if you want to try it now.
In the terminal use Ctrl C to kill the VNC server so you can proceed
Set the VNC password
this will prompt you for a password to access this linux system when you connect over VNC, when it asks for a View-Only password say no.
Start the VNC server again BUT now requiring a password (getting closer)
now where in the line it shows <user> this is the username of the account you used to login, in my case its is vk5pj
or $ x0vncserver -PasswordFile=/home/vk5pj/.vnc/passwd
This will now have the VNC server running as an interactive process from that console window, not exactly handy as you have to be logged in an remember to run it....
Next step is to make it run as a service under Linux... now this required the help from yet another Forum... what are the chances of that, sorry Doug.
GITHUB Answer
On this page, it shows the steps on how to create the needed files and commands to get the vnc server to run as a service under linux, phew.
Firstly you need to create a script file, Create a file with path /usr/local/bin/x0vnc.sh
Edit this file with a text editor and paste this code, be sure to replace 'vk5pj' with the linux username your using.
This is the script that is going to be referenced in the service startup config that follows
Create a file with path /etc/systemd/system/x0vncserver.service
edit it with a text editor and past in this code.
now we can test the script but first we need to declare it as an executable file
Launch the script
Try to connect via VNC. you will need a password.
Now lets make this all into a service with the help of the systemd unit
Enable autostart at boot up.
yes I know that's a lot of steps to make VNC work and a smarter person that I could probably script that but as I only need to do it once what is the point
I doubt many if any will want to duplicate this but found forums are a handy place to document your own work even if very few follow the same path,
After a great deal of searching and failure I found this forum post... YES an answer on a forum, who would have thought that.
While his english syntax is not that great the actual code you need to run is all outlined here: VNC Install So just in case his posting disappears, I will try and transfer the steps to here. This is all done in a terminal window (Console view)
Install the basic VNC software:
Code:
sudo apt-get install tigervnc-scraping-server
Update the packages
Code:
sudo update-alternatives --config x0vncserver
Start the VNC server for the first time
Code:
x0vncserver -SecurityTypes=none
At this point you can connect to the computer via VNC without a password if you want to try it now.
In the terminal use Ctrl C to kill the VNC server so you can proceed
Set the VNC password
Code:
vncpasswd
this will prompt you for a password to access this linux system when you connect over VNC, when it asks for a View-Only password say no.
Start the VNC server again BUT now requiring a password (getting closer)
Code:
x0vncserver -PasswordFile=/home/<user>/.vnc/passwd
now where in the line it shows <user> this is the username of the account you used to login, in my case its is vk5pj
or $ x0vncserver -PasswordFile=/home/vk5pj/.vnc/passwd
This will now have the VNC server running as an interactive process from that console window, not exactly handy as you have to be logged in an remember to run it....
Next step is to make it run as a service under Linux... now this required the help from yet another Forum... what are the chances of that, sorry Doug.
GITHUB Answer
On this page, it shows the steps on how to create the needed files and commands to get the vnc server to run as a service under linux, phew.
Firstly you need to create a script file, Create a file with path /usr/local/bin/x0vnc.sh
Edit this file with a text editor and paste this code, be sure to replace 'vk5pj' with the linux username your using.
Code:
#! /bin/bash
# Export an environment variable of the Display Manager
export XAUTHORITY="/var/run/lightdm/root/:0"
# Start VNC server for :0 display in background
## Set path to binary file
VNC_BIN=/usr/bin/x0vncserver
## Set parameters
#PARAMS="-display :0 -SecurityTypes None"
PARAMS="-display :0 -passwordfile /home/vk5pj/.vnc/passwd"
if [[ -f /etc/vnc.conf ]];
then
## Launch VNC server
($VNC_BIN $PARAMS) &
else
## Add parameters
PARAMS+=" --I-KNOW-THIS-IS-INSECURE"
## Launch VNC server
$VNC_BIN $PARAMS
fi
# Provide clean exit code for the service
exit 0
This is the script that is going to be referenced in the service startup config that follows
Create a file with path /etc/systemd/system/x0vncserver.service
edit it with a text editor and past in this code.
Code:
[Unit]
Description=Remote desktop service (VNC) for :0 display
# Require start of
Requires=display-manager.service
# Wait for
After=network-online.target
After=display-manager.service
[Service]
Type=forking
# Set environment
Environment=HOME=/root
# Start command
ExecStart=/usr/local/bin/x0vnc.sh
# Restart service after session log out
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
now we can test the script but first we need to declare it as an executable file
Code:
sudo chmod +x /usr/local/bin/x0vnc.sh
Launch the script
Code:
sudo /usr/local/bin/x0vnc.sh
Try to connect via VNC. you will need a password.
Now lets make this all into a service with the help of the systemd unit
Code:
sudo systemctl daemon-reload
sudo systemctl start x0vncserver.service
sudo systemctl status x0vncserver.service
Enable autostart at boot up.
Code:
sudo systemctl enable x0vncserver.service
yes I know that's a lot of steps to make VNC work and a smarter person that I could probably script that but as I only need to do it once what is the point
I doubt many if any will want to duplicate this but found forums are a handy place to document your own work even if very few follow the same path,
Peter Sumner, vk5pj
You have enemies? Good. That means you've stood up for something, sometime in your life.
- Winston Churchill
You have enemies? Good. That means you've stood up for something, sometime in your life.
- Winston Churchill