How to get Linux remote desktop using VNC session

Many times we have created a Linux session using the famous Putty tool. What if you need to create a Remote Desktop (GUI) session on Linux? Answer in VNC Server, this post will walk you through how to get a Linux Remote Desktop Session session.

Configuring a VNC Server for a Remote Desktop Session on Linux


1. Installing desktop packages:

First, you need to install the packages on the desktop on the server.

[[email protected] ~]# yum groupinstall "Desktop"

2. Installing the Tiger VNC package on the server.

In addition, the Tiger VNC package needs to be installed on the server, which will allow us to host Linux remote desktop.

[[email protected] ~]# yum install vnc-server

3. Configuring a VNC user for Linux remote desktop sessions.

If you want to create a custom user for a Linux remote desktop session, you can create using the procedure below, otherwise you can also use any existing users for this. Here I add a new user “vncuser”.

[[email protected] ~]# useradd user1
[[email protected] ~]# passwd user1
Changing password for user user1.
New password:
BAD PASSWORD: it is based on your username
Retype new password:
passwd: all authentication tokens updated successfully.
[[email protected] ~]#

After you are done with creating the user, you need to set the VNC password using the vncpasswd command as shown below:

[[email protected] ~]# su - user1
[[email protected] ~]$ vncpasswd user1
[[email protected] ~]$ exit
[[email protected] ~]#

4. Setting the screen resolution for a remote desktop session in Linux.

Now, to adjust the screen resolution, you need to add the line of code below to the file “/ etc / sysconfig / vncservers”.

VNCSERVERARGS[1]="-geometry 1024x768"

In the code above, we have defined the screen size “1024 x 768” for our remote user “user1”.