how to configure VNC on Linux

VPS and dedicated server security tips. Preventing from attacks, ddos and more.

how to configure VNC on Linux

Postby Mark » Tue Dec 22, 2009 9:32 pm

You can access Linux server in GUI mode as like RDP in Windows.
For this you will have to configure VNC service on your Linux server.

Steps to configure VNC on Linux Servers for root user.

You should have vnc-server rpm package installed.

vnc-server-X.X.X-X.el5

1) Put following two lines in /etc/sysconfig/vncservers


Code: Select all
VNCSERVERS="2:root"
VNCSERVERARGS[2]="-geometry 800x600"

the above lines will enable VNS server on terminal 2 for user root with 800x600 resolution.

2) Create a xstartup file in .vnc directory under the user for which you want to configure VNC. In this example we are configure it for root user so file would be as follows.

Code: Select all
# vi /root/.vnc/xstartup


#!/bin/bash


# Uncomment the following two lines for normal desktop:
Code: Select all
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc


Code: Select all
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &


3) run vncpasswd command to add/set vnc password for root.


4) then restart vncserver


Code: Select all
/etc/init.d/vncserver start
Mark
 
Posts: 124
Joined: Fri Dec 11, 2009 2:18 pm

Return to Securing your server

Who is online

Users browsing this forum: No registered users and 1 guest

cron