When managing multiple operating systems of different types, it’s handy to use a quick remote desktop sessions to connect to each server type. Also, there are plenty of Remote Desktop Connection managers which offer the ability to aggregate multiple connection settings for several systems in a convenient console. Effectively a single pane of glass! This article covers the steps to configure a Linux CentOS 7 Remote Desktop Connection using a VNC compatible client on a Windows machine.
There are very popular protocols and standards when connecting to various operating systems. Typically, Remote Desktop Connection (RDP) for Windows based OS and Virtual Network Computing (VNC) for Linux/Unix based OSes. More or less they offer very similar configuration settings. The purpose of this article is to cover the simple steps to connect to multiple VMs from a single console or remote desktop manager like mRemoteNG running on Windows. In this case for a non Windows based OS it is possible to use VNC protocol which is a “standard” with Linux OSes and also applies to the Linux CentOS 7 Remote Desktop connection.
mRemoteNG includes a wide range of protocol and configuration settings making this a convenient solution to connect to RDP, VNC, SSH, Telnet, Rlogin, RAW, HTTP(S) servers and more!
In this article the steps to configure the Linux CentOS 7 Remote VNC Server and how to connect from Windows 10 using mRemoteNG by mean of VNC Client.
Setup Linux CentOS 7 Remote Desktop Connection
The first part is to setup the Linux CentOS 7 Remote Server connection to run the VNC Server service and allow the connection from compatible VNC clients. Connections can be secured with passwords and on specific ports. In addition, the option to secure the VNC Remote Desktop Connection using an SSH tunnel.
From the Linux CentOS 7 machine let’s start a new terminal session. If not running as root, the “sudo” will go together with the rest of the commands.
First steps is to install the “tigervnc-server” from the epel-release repo as already covered in the previous article. This would be a simple command like:
“sudo yum install tigervnc-server”
By accepting the prompts about repo and verified packages the final result should be something similar to this.
If the logged in user is allowed to remotely connect to this server it is possible to run:
to create a password for the VNC user. Alternatively with a “su – UserName” the password will be created for the intended user without logging to a different session. Same procedure includes the step to create a password for view-only during the remote session.
The Linux CentOS 7 Remote Desktop installation requires a configuration file for each intended user with specific settings. These can be easily copied from the main one used as a template:
“sudo cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:1.service”
This would be the first configuration file to edit for the first user:
“sudo nano /lib/systemd/system/vncserver@:1.service”
By scrolling down the file the configuration shows the section where to replace the with the desired username allowed to connect to the Linux server.
So the final result should look something similar to this.
Now that the configuration for the intended user is created it is a matter to restart the main VNC service daemon, start the instance for the selected user and optionally make this user instance available at each reboot at the Linux Server.
The command sequence would be:
- “systemctl daemon-reload”
- “systemctl start vncserver@:1”
- “systemctl status vncserver@:1”
- “systemctl enable vncserver@:1”
As a proof with the “ss” command the terminal shows the open and active network connections:
“ss -tulpn | grep vnc”
The terminal shows the Network Port 5901 is associated to user 1. Next would be Port 5902 for user 2 and so on. 5900 is the default port for the main VNC server service.
At this point it is time to add the firewall rule to accept incoming connections. In this case for port 5901:
“firewall-cmd –add-port=5901/tcp –permanent”
It is also a good idea to restart or reload the firewalld service. Everything is now ready from the server side.
Any client machine running any VNC compatible client can now connect to the Linux CentOS 7 Remote Desktop. With mRemoteNG it is very easy. It’s just a matter of creating a new connection and specify the VNC as connection protocol on port 5901. More Ports can be configured as per steps above.