Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5379780
  • 博文数量: 890
  • 博客积分: 12876
  • 博客等级: 上将
  • 技术积分: 10760
  • 用 户 组: 普通用户
  • 注册时间: 2004-10-04 14:18
个人简介

猝然临之而不惊,无故加之而不怒。

文章分类

全部博文(890)

文章存档

2016年(1)

2014年(18)

2013年(41)

2012年(48)

2011年(65)

2010年(84)

2009年(121)

2008年(101)

2007年(129)

2006年(95)

2005年(118)

2004年(69)

分类: LINUX

2009-04-17 17:10:33

RHEL5下配置vncserver

一,设定VNC密码
[root@db2 .vnc]# vncpasswd
Password:
Verify:

二,配置VNC启动脚本,默认Xwindows是没有起来的,要修改一下

首次创建 ~/.vnc/xstartup 时,指定的窗口管理器是 twm ,它是一个极小的窗口管理器,几乎每台 X Window 系统机器上都有 twm。twm 不具备完整“桌面管理器“
(像 KDE、GNOME或 WindowMaker)的大部分花哨功能。

[root@db2 .vnc]# more 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 &
startx &
#startkde &
#gnome-session &

三,启动VNCSERVER
[root@db2 .vnc]# vncserver

New 'db2.domain:2 (root)' desktop is db2.domain:2

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/db2.domain:2.log

四,访问VNCSERVER


vncviewer ip:2

五,关掉VNCSERVER进程

 vncserver -kill


PS:
目前都是以root身份登陆的,太危险了。
需要设置具体登陆的用户和分辨率,可以修改/etc/sysconfig/vncservers文件:

# vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the line below to start a VNC server on display :1
# 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
#
VNCSERVERS="1:oracle"
VNCSERVERARGS[1]="-geometry 1024x768"

/etc/sysconfig/vncserver要这样设置:

为每个你允许使用vnc的用户添加两行
VNCSERVERS="x:username"
VNCSERVERARGS[x]="-geometry 800x600 -query localhost"

这里,第一行中x>0,5800+x和5900+x分别是vnc监听的端口,前者是使用http协议的,第二行是设置该用户vnc进程的参数。

例如:
VNCSERVERS="3:foo"
VNCSERVERARGS[3]="-geometry 800x600 -query localhost"

表示用户foo可以通过 或用vnc viewer连接serverip:5903 来访问。

最后,要为每个使用vnc的用户用vncpasswd命令设置访问口令。
阅读(2342) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~