Deployment

Linux CentOS 7 Remote Desktop Connection with VNC

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”

domalab.com Linux CentOS 7 Remote vnc install

By accepting the prompts about repo and verified packages the final result should be something similar to this.

domalab.com Linux CentOS 7 Remote tigervnc server

If the logged in user is allowed to remotely connect to this server it is possible to run:

“vncpasswd”

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.

domalab.com Linux CentOS 7 Remote vnc password

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”

domalab.com Linux CentOS 7 Remote vnc configuration

This would be the first configuration file to edit for the first user:

“sudo nano /lib/systemd/system/vncserver@:1.service”

domalab.com Linux CentOS 7 Remote user config

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.

domalab.com Linux CentOS 7 Remote configuration file

So the final result should look something similar to this.

domalab.com Linux CentOS 7 Remote configuration file

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”

domalab.com Linux CentOS 7 Remote vnc service

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.

domalab.com Linux CentOS 7 Remote vnc open ports

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.

domalab.com Linux CentOS 7 Remote vnc firewall port

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.

domalab.com Linux CentOS 7 Remote vnc client mRemoteNG

About the author

Michele Domanico

Passionate about Virtualization, Storage, Data Availability and Software Defined Data Center technologies. The aim of Domalab.com is sharing with the Community the knowledge and experience gained with customers, industry leaders and like minded peers. Always open to constructive feedback and new challenges.

Add Comment

Click here to post a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Browse articles

December 2018
M T W T F S S
« Nov    
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Articles by Category

Archives

%d bloggers like this: