One of my needs is to access my desktop remotely from my office. There are many existing solutions (Screen Connect, RealVNC)that provide remote controlling property and their setups are as simple as installing apps. However, you usually need to pay for the services to use them. I would like to set up a remote desktop with my own flavor, so X11VNC would be my best choice.
X11VNC shares the same desktop session with your remote computer, which means when you make operations on the remote desktop, the screen on the remote side will correspondingly show those operations. And if there’s someone sitting in front of your remote computer, he can see what you’re doing right now and disturb with mouth and keyboard. Hence, if you want a separate session for remote connection, it’s better to use TigerVNC to address this issue. For those people whose computer is located at home (non-public), it’s recommended to use this tool.
Install X11VNC
Installing X11VNC will be easy, we just need to type the commands as follows:
sudo apt update
sudo apt install x11vnc
Create Password
Next, a password needs to be set for connecting the remote desktop:
x11vnc -storepasswd
Enter VNC password: *********
Verify password: *********
Write password to /home/name/.vnc/passwd? [y]/n y
Password written to: /home/name/.vnc/passwd
Start VNC Server
Now, we can start the X11VNC server with a single command (substitute the -rfbauth
path, -rfbport
respectively):
x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/name/.vnc/passwd -rfbport 5900 -shared
If we want this server to start every time after the system boots, we can add this command into the system’s Startup Applications
. Open the application from the launcher, click the add
button to add a new startup application. Give a name to this action like “X11VNC Server Startup”, write the same command showed above, and write a description for this action. Then, click the save
button.
Connect using VNC Client
For this part, I use the client from RealVNC because it has multi-platform support for my iPad, Mac, and iPhone.
Here, I use my iPad and type my remote desktop’s local IP address (192.168.1.xxx) as shown in the image below.
You are required to type the password we just set after establishing the connection. After the authentication, you should see the desktop image of the remote computer similar to the image shown below.
Conclusion
As we can see here, this is just a local connection to my remote desktop. It still doesn’t meet my requirement to work remotely in an office rather than at home. To achieve this, we could use ssh
tool for encrypting our connection to the computer.
ssh user@remote-server -L 5900:127.0.0.1:5900
This solution works for those people have a public IP address for the remote computer. It maps the local 5900 port to the remote computer’s 5900 port. However, I just have home Internet at the moment. And finally, I addressed this problem by using reversed proxy (which I set up in the previous post) to expose my home remote computer. The reversed proxy part will be introduced in the future post.