Show Menu
Cheatography

Instal­lation

yum install tigerv­nc-­server tigervnc RedHat Enterprise Linux

Config­uration - Single User

copy config­uration file
cp /usr/l­ib/­sys­tem­d/s­yst­em/­vnc­ser­ver­@.s­ervice /etc/s­yst­emd­/sy­ste­m/v­ncs­erv­er@.se­rvice
replace USER with actual user
vi /etc/s­yst­emd­/sy­ste­m/v­ncs­erv­er@.se­rvice
ExecSt­art­=/u­sr/­sbi­n/r­unuser -l USER -c "­/us­r/b­in/­vnc­server %i -geometry 1280x1­024­"
PIDFil­e=/­hom­e/U­SER­/.v­nc/­%H%­i.pid
reload systemd daemon
systemctl daemon­-reload
set the password for the user
su - USER
vncpasswd
start vnc server
systemctl start vncser­ver­@:1.se­rvice
systemctl enable vncser­ver­@:1.se­rvice

Config­uration - Two Users

copy config­uration file
cp /usr/l­ib/­sys­tem­d/s­yst­em/­vnc­ser­ver­@.s­ervice /etc/s­yst­emd­/sy­ste­m/v­ncs­erv­er-­USE­R_1­@.s­ervice
cp /usr/l­ib/­sys­tem­d/s­yst­em/­vnc­ser­ver­@.s­ervice /etc/s­yst­emd­/sy­ste­m/v­ncs­erv­er-­USE­R_2­@.s­ervice
replace USER with actual user
vi /etc/s­yst­emd­/sy­ste­m/v­ncs­erv­er-­USE­R_1­@.s­ervice
ExecSt­art­=/u­sr/­sbi­n/r­unuser -l USER_1 -c "­/us­r/b­in/­vnc­server %i -geometry 1280x1­024­"
PIDFil­e=/­hom­e/U­SER­_1/.vn­c/%­H%i.pid
vi /etc/s­yst­emd­/sy­ste­m/v­ncs­erv­er-­USE­R_2­@.s­ervice
ExecSt­art­=/u­sr/­sbi­n/r­unuser -l USER_2 -c "­/us­r/b­in/­vnc­server %i -geometry 1280x1­024­"
PIDFil­e=/­hom­e/U­SER­_2/.vn­c/%­H%i.pid
reload systemd daemon
systemctl daemon­-reload
set the password for the user
su - USER_1
vncpasswd
su - USER_2
vncpasswd
start vnc server
systemctl start vncser­ver­-US­ER_­1@:­3.s­ervice
systemctl enable vncser­ver­-US­ER_­1@:­3.s­ervice
systemctl start vncser­ver­-US­ER_­2@:­5.s­ervice
systemctl enable vncser­ver­-US­ER_­2@:­5.s­ervice
 

Config­uration - Xinetd

install packages
yum install gdm tigervnc tigerv­nc-­server xinetd
start xinetd
systemctl enable xinetd.se­rvice
systemctl start xinetd.se­rvice
set systemd default target
systemctl set-de­fault graphi­cal.target
enable XDMCP
vi /etc/g­dm/­cus­tom.conf
[xdmcp]
Enable­=true
create xnvcserver file
vi /etc/x­ine­td.d­/x­vnc­server
service servic­e_name
{
disable = no
protocol = tcp
socket­_type = stream
wait = no
user = nobody
server = /usr/b­in/Xvnc
server­_args = -inetd -query localhost -once -geometry
select­ed_­geo­metry -depth select­ed_­depth securi­tyt­ype­s=none
}
define service
vi /etc/s­ervices
# VNC xinetd GDM base
servic­e_name 5950/tcp
reboot system
reboot
verify that gdm is listening on UDP port 177
netstat -anu|grep 177
restart the xinetd service
systemctl restart xinetd.se­rvice
verify that the xinetd service has loaded the new services
netstat -anpt|grep 595
test the setup
vncviewer localh­ost­:5950
configure firewall
firewa­ll-cmd --perm­anent --zone­=public --add-­por­t=5­950/tcp
firewa­ll-cmd --reload

Config­uration - Share Existing Desktop

install packages
yum install tigerv­nc-­server
set the VNC password
vncpasswd
start x0vncs­erver
x0vncs­erver -Passw­ord­Fil­e=.v­nc­/passwd -Alway­sSh­ared=1
 

VNC Viewer

start viewer
vncviewer address:displa­y_n­umber

Config­uration - Firewall

see firewalld settings
firewa­ll-cmd --list-all
open a port for TCP traffic in the public zone
firewa­ll-cmd --zone­=public --add-­por­t=5­904/tcp
view the ports that are currently open for the public zone
firewa­ll-cmd --zone­=public --list­-ports

Tips & Tricks

connecting to VNC Server Using SSH
vncviewer -via user@host:displa­y_n­umber
restri­cting VNC Access
ExecSt­art­=/u­sr/­sbi­n/r­unuser -l user -c "­/us­r/b­in/­vnc­server -localhost %i"
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          More Cheat Sheets by misterrabinhalder

          RPM Cheat Sheet