miercuri, 23 octombrie 2013

Let's properly config the VNC servers

First step: put the right code into vncservers file

cat >> /etc/sysconfig/vncservers <<EOF
 VNCSERVERS="1:root 2:oracle"
 VNCSERVERARGS[1]="-geometry 1152x864 -depth 16"
 VNCSERVERARGS[2]="-geometry 1152x864 -depth 16"
EOF

(i assume we all need the user oracle)
then

mkdir /root/.vnc
chmod -R 775 /root/.vnc

Be aware, in the next step, comment all the lines in /root/.vnc/xstartup and then:

cat >> /root/.vnc/xstartup <<EOF
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -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 &
gnome &
EOF

then:

vncserver  :1

chmod 777 /root/.vnc/xstartup

su - oracle
mkdir /home/oracle/.vnc
chmod -R 775 /home/oracle/.vnc

cat >> /home/oracle/.vnc/xstartup <<EOF
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -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 &
gnome &
EOF

vncserver  :2

 chmod 777  /home/oracle/.vnc/xstartup

su -

chkconfig vncserver on
service vncserver stop
service vncserver start

/etc/init.d/vncserver restart


and all you have to do now is to use the VNC client in order to have a nice remote desktop with the server, either under oracle or root user. Enjoy!

Niciun comentariu:

Trimiteți un comentariu