全部博文(50)
分类: LINUX
2014-02-08 19:58:47
rpm -qa |grep vnc
如果有类似于:
vnc-server-
的值返回说明已经安装了vnc-server
|
首先添加用户:
adduser kevin 设置用户密码: passwd kevin
Password:
Verify: |
配置vnc-server的配置文件,位于:
/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 # URL: # VNCSERVERS="1:myusername" VNCSERVERS="1:tchung"----->这里的tchung是系统里存在的用户
VNCSERVERARGS[1]="-geometry 1024x768" ----->这里的意思是配置用户tchung的相关参数
这里有两点要注意:
1.VNCSERVERS=后面可以支持多用户,以空格隔开。如:
VNCSERVERS="1:myusername 15:otheruser"--->这里的1 和15是端口号,用于连接时的端口
2.VNCSERVERARGS后面的[]里面的数据要与VNCSERVERS后面对应用户的值要一致。好像不一致也没有关系
VNCSERVERARGS基本参数有:
-geometry 桌面大小,缺省是1024x768
-nohttpd 不监听HTTP端口 -nolisten tcp 不监听X端口 -localhost 只允许从本机访问 -AlwaysShared 默认的, 同时只能有一个vncviewer连接(跟客户端配置也有关), 一旦第2个连上去, 第1个就被断开了. 此参数允许同时连多个vncviewer -SecurityTypes None登录不需要密码认证 VncAuth默认值,要密码认证 |
vncpass
Password: Verify: 注意,这里的vncpass只能在vnc本用户下面来运行 |
#!/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 &
|
# 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 # For a secure way of using VNC, see # URL:http://www.uk.research.att.com/vnc/sshvnc.html # VNCSERVERS="1:myusername" VNCSERVERS="1:tchung" VNCSERVERARGS[1]="-geometry 1024x768 -nohttpd -nolisten tcp" |