Pages

Tuesday, September 16, 2008

Linux (RedHat) 下 VNCServer 的使用

VNCServer 使用

啟動 vncserver

使用個人帳號直接執行vncserver,第一次執行時會要求輸入密碼,不一定要跟系統的一樣,連線後權限同原帳號(建議不要使用root)

[testuser@testserver ~]$ vncserver

 

New 'testserver.testdomain:1 (testuser)' desktop is testserver.testdomain:1

 

Starting applications specified in /home/testuser/.vnc/xstartup

Log file is /home/testuser/.vnc/testserver.testdomain:1.log

 

使用 VNC連線

第一種方式直接用 vncviewer 連線

輸入 server ip 或名稱,port 5901 則代表 :1

 

 輸入剛才設定的密碼(與系統密碼不同)


登入後是陽春的 twm自已的桌面也找不到了。


來修改 xstartup ,變更為 gnome (or kde)

[testuser@testserver .vnc]$ vi /home/testuser/.vnc/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" &

# twm &

gnome-session &

# startkde &

Kill 掉原來的程序

[testuser@testserver ~]$ vncserver –kill :1

Killing Xvnc process ID 4533

重新啟動

[testuser@testserver ~]$ vncserver

 

New 'testserver.testdomain:1 (testuser)' desktop is testserver.testdomain:1

 

Starting applications specified in /home/testuser/.vnc/xstartup

Log file is /home/testuser/.vnc/testserver.testdomain:1.log

登入後就是漂亮的 gnome 和原本的桌面啦


另一種連結方式:

Windows 底下開 browser,輸入網址(port 5801 代表 :1)

http://testserver:5801/


登入後只有 256 色,效能也沒有 vncviewer 好,應急時可使用