Configuring VNC Server and SSH Remote Access on Linux
This guide explains how to install and configure a VNC server on a Linux virtual machine, set a static IP, manage firewall and SELinux settings, and use SSH for remote command‑line access, including all necessary commands and client setup steps.
This article describes how to install a VNC server on a Linux virtual machine to enable remote graphical control from another computer.
It first shows how to view the IP address on different operating systems: ipconfig on Windows, ifconfig on Linux and macOS.
To assign a fixed IP, the VM is set to bridge mode so it shares the same LAN as the host, obtaining an address like 192.168.1.xxx.
It warns not to use the root account for remote connections to avoid screen black‑out issues.
dnf install tigervnc-server tigervnc-server-module -y
## Add user
useradd vncserver
passwd vncserver
## Set VNC password for the remote user
su - vncserver
$ vncpasswd
Password:
Verify:
Would you like to enter a view‑only password (y/n)? n
A view‑only password is not used
# Create systemd service file /etc/systemd/system/[email protected]
[Unit]
Description=Remote Desktop VNC Service
After=syslog.target network.target
[Service]
Type=forking
WorkingDirectory=/home/vncserver
User=vncserver
Group=vncserver
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -autokill %i
ExecStop=/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.targetBy default, the VNC server listens on TCP port 5900+n, where n is the display number (e.g., display 1 uses port 5901).
systemctl daemon-reload
systemctl start vncserver@:1.service
systemctl enable vncserver@:1.service
systemctl status vncserver@:1.serviceYou can verify the listening port with netstat -anlpt | grep 5901. The guide also provides commands to stop and disable the firewall and SELinux:
# Disable firewall
systemctl stop firewalld
systemctl disable firewalld
# Temporarily disable SELinux
setenforce 0
# Permanently disable SELinux
vim /etc/sysconfig/selinux
SELINUX=disabledFor the VNC client, it recommends downloading RealVNC Viewer from the provided URL.
The article then covers SSH remote access: checking the sshd service status, installing an SSH client on Windows (e.g., Xshell), and connecting with ssh user@host or ssh [email protected].
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
