Step1 : 確認系統是否有安裝 vncserver
透過 rpm –qa vnc 的指令來確認是否有安裝 vncserver
# rpm -qa | grep vnc
vnc-server-4.0-11.el4
vnc-4.0-11.el4
Step2 : VNC Server 的設定配置
1) 第一次啟動vncserver 會提示輸入密碼:
甲、Root
# vncserver
You will require a password to access your desktops.
Password:
輸入vnc 連接密碼
Verify: 確認vnc密碼
xauth: creating new authority file /root/.Xauthority
New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
乙、Non-root account
$ vncserver
You will require a password to access your desktops.
Password: 輸入vnc 連接密碼
Verify: 確認vnc密碼
xauth: creating new authority file /home/huilin/.Xauthority
New 'localhost.localdomain:2 (huilin)' desktop is localhost.localdomain:2
Creating default startup script /home/huilin/.vnc/xstartup
Starting applications specified in /home/huilin/.vnc/xstartup
Log file is /home/huilin/.vnc/localhost.localdomain:2.log
2) 配置vnc的配置檔xstartup檔
# vi xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
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" &
gnome-session gnome 添加連接時使用 gnome 桌面環境
twm &
3) 在vncserver設置登錄用戶的資訊
#vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.
# Use "-nolisten tcp" to prevent X connections to your VNC server via
TCP.
# Use "-nohttpd" to prevent web-based VNC clients connecting.
# Use "-localhost" to prevent remote VNC clients connecting except
when
# doing so through a secure tunnel. See the "-via" option in
the
# `man vncviewer' manual page.
VNCSERVERS="1:root
2:demo" 此處添加用戶
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd
-localhost"
#vncserver -geometry 800x600 設置vncserver的解析度
#vncserver -geometry 640x480 設置vncserver的解析度
#vncserver -depth 8
設置vncserver的色深
#vncserver -depth 16 設置vncserver的色深
4) 用戶端的連接
a、在linux下,運行vncviewer命令即可,伺服器位址的寫法形如192.168.3.119:1
b、在windows下,運行windows版本的vncviewer即可,用法與linux下相近。
c、用流覽器(平臺無關),作為java
applet來實現,以形如http://192.168.3.119:5801的方式來啟動 (vnc 埠從5800 開始依次類推,一般會是5800,5900)
5) 修改密碼
運行vncpasswd即可
6)
停止vncserver
#vncserver -kill :1
#vncserver -kill :2
注意到vncserver只能由啟動它的用戶來關閉,即時是root也不能關閉其他用戶開啟的vncserver,
除非用kill命令暴力殺死進程。
7)
穩定性設置
vncserver默認在多個客戶機連接同一個vncserver的顯示埠時,vncserver埠舊連接,而為新連接服務,可通過-dontdisconnect拒絕新連接請求而保持舊的連接。
8)
同一個顯示器可以連接多個客戶機
#vncserver –alwaysshared
轉自:http://blog.chinaunix.net/u2/80794/showart.php?id=1920885
留言列表