Remote Desktop Sharing with X11VNC (mint edition)
Hi guys its Unleashed Code and today I want to show you how to setup a remote connection to your desktop using a piece of software called VNC. (Virtual Network Connection)
The steps to follow are very simple and shall allow you to connect remotely to your desktop “from the login screen” and so you can utilise your computer wherever you are in the house or office or even remotely.
Please be warned in advance that this is not over a secure port but maybe later I will do another video showing you how this can be secured y using ssh on port 22 and how to tunnel the port 5900 (used by x11vnc).
Throughout this video I will be using Linux Mint (Debian based) so if your distribution is different you may need slightly different commands to get the software from your repositories.
Right with the disclaimers out of the way…. Let us begin,
Firstly you need to download the software X11VNC. This software is the server that you can connect to. To get it open a terminal and type : “sudo apt-get install -y x11vnc”
Now the server software is installed let's set it up to have a password. It needs a password to authenticate the user on the port. To do this type: “x11vnc -storepasswd /home/yourusername/.vnc/passwd”
Type in the password that you have decided on and it will ask you to confirm that password.
It will now show you your chosen directory to store the password. Type “Y” and agree to the passwd store location.
That's all there is to having the server setup to run… but let's look at how you can get this to run at boot so you don't have to even log into your remote computer and setup x11vnc every time you want to make a connection. Please note that this will differ from distro to distro and you need to know what you display manager is. e.g. Gnome's gdm (Gnome Display Manager),
We are using Linux Mint Cinnamon so our display server is mdm (Mint Display Manager).
Type into a terminal using your favourite editing tool (mine is nano) “sudo nano /etc/mdm/Init/Default”
Now we have your configuration for the mint display manager (mdm). Scroll down to the bottom where you will come to the exit for the script, “exit 0”. Just before this we need to enter the command line to start x11vnc with a few custom options. If your not using cinnamon you will need to find the Init script for your display manager more than likely somewhere in your /etc/ folder which you will require sudo permissions to access
Type this just above “exit 0” : “/usr/bin/x11vnc -shared -forever -noxdamage -rfbport 5900 -bg -o /var/log/x11nvc.log -rfbauth /home/yourusername/.vnc/passwd Now save and exit the file.
The options above are the path to your vnc binary / -shared means that more than one connection can co-exist / -forever means that when you disconnect or finish your remote session it will not kill the server as well / -noxdamage is used to prevent your session crashing when framebuffer changes mark the whole screen as damaged but in reality is actually only a small portion of the screen, xdamage can close your session otherwise /-rfbport 5900 specifies the port / -bg allows the x11vnc server to run in the background after initial screen setup / -o allows for logging and a location to store the logs (handy if you run into some problems) / -rfbauth and the passwd file location means that your connection has to be authenticated using the password that you had chosen when we set up the x11vnc server (-storepasswd)./
Now you must save and exit the /etc/mdm/Init/Default script.
To restart the mdm server so you can try to log into the x11vnc server you must type in the terminal : “sudo service mdm restart”
That is it folks. Now you should be able to go to your client computer and use a program like VNC Viewer or Ultra VNC to log into your computer remotely. You will need to know the IP address of the computer that you just set up x11vncserver on and some vnc viewers may specify that you also know the port (5900) 192.168.0.23:5900 as an example to log in.
Another tip if you use Google Chrome as your web browser is to go to Apps and then the webstore. Type in a search for VNC Viewer for Google Chrome and then click on the +Add to Chrome button once you find it. Now you have a vnc viewer in your web browser applications. Works perfectly.
I will leave you with just one other option in the event that you do not want to run x11vnc server on boot but you actually want to manually start it from the computer whenever you wish to use it ( a bit more secure until I do my ssh tunneling tutorial as it is then not running continuesly even when you do not need it ) and that is to create a simple script. Lets do that now,
Got your home directory and create a blank script by typing “touch vncserverstart”
Now lets open that file in an editor “nano vncserverstart”
In this blank file we are going to make a bash script to start the x11vnc program
Type the following below into the script
#!/bin/bash
#x11vnc server script written by your name and the date (makes it easy to find with grep)
/usr/bin/x11vnc -shared -noxdamage -rfbport 5900 -bg -o /var/log/x11nvc.log -rfbauth /home/unleashedcode/.vnc/passwd &
echo “x11vnc server started!”;
Now save and close the script. (You may have oticed we did not include the-forever option in the command line, this will mean that if you disconnect from x11vnc it will terminate the connection and you will be required to start the script again).
We now have to make it executible by changing the files persmission.
Type “chmod +x vncserverstart”
There we go, now all you have to do to start your x11server session is to login to your computer, go to your home directory and type “./vncserverstart&”
Hope you all found some benefit in this tutorial. Do not forget to subscribe to my YouTube channel if you wish to see more and also click that like button if I have managed to help you at all.
Kind regards everyone and until next time
Code out!
Comments
Post a Comment