CODE:[root@localhost ~]# 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
# URL:http://www.uk.research.att.com/vnc/sshvnc.html
# VNCSERVERS="1:myusername"
VNCSERVERS="1:root" (注意:root是CentOS用户名)
如果建2个,可以用VNCSERVERS="1:root 2:linglong"来配置
3.用vncpasswd创建一个vnc的口令
注意这将同时在你的home目录下,创建一个隐藏的目录.vnc,其中有一个文件passwd保存着你的vnc口令.
CODE:
[root@localhost ~]# vncpasswd
Password:
Verify:
[root@localhost ~]# ls -d .vnc
.vnc
[root@localhost ~]# ls .vnc
passwd
VNCServer配置
redhat 一般都自动安装了vncserver了 只要在服务列表中选中启动一下就可以.
通过编辑文件$HOME/.vnc/xstartup来启动你喜欢的窗口管理器。使用
startkde & 来启动KDE,使用 gnome-session & 来启动GNOME.
首次创建 ~/.vnc/xstartup 时,指定的窗口管理器是 twm ,它是一个极小的窗口管理器,几乎每台 X Window 系统机器上都有 twm。twm 不具备完整“桌面管理器”(象 KDE、GNOME 或 WindowMaker)的大部分花哨功能。下面是修改过的示例:
#!/bin/sh
[ -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 &
#exec wmaker
#exec startkde
gnome-session &
上面的示例中,注释掉了缺省 twm 和 xterm 的缺省启动。配置了这个桌面来避免背景和标题栏上的颜色渐变,并使用极少的动画效果。
关闭服务器上自己的vnc连接
vncserver -kill :桌面号
开机自动运行vncserver
1.设置vncserver启动脚本(/etc/init.d/vncserver)实现系统自启动时启动vncserver.
2.编辑/etc/sysconfig/vncservers
VNCSERVERS="1:user1"
ARGS="-geometry 800x600 -alwaysshared "
在ARGS 中修改"800x600"来适应自己的X桌面实际参数配置。可以在这里添加任何其他VNC服务器参数配置。在VNCSERVERS中修改 user1 为你希望运行VNC桌面的用户。VNCSERVERS中的1表示VNC以桌面1运行,如果希望添加其他的桌面,可以修改配置如下:
VNCSERVERS="1:user1 2:user2 3:user3"
3.设置vnc server的访问密码
vncpasswd
在RedHat系统上,使用以下命令启动VNC:
/etc/init.d/vncserver start
----------------------------------------------2--------------------------------------------------
Linux系统远程桌面(VNC)配置方法
Linux默认安装了VNC服务,为了以后方便使用,可在ntsysv里设置vnc服务为开机自动启动。
如果系统安装了防火墙,建议关掉或者加入vnc的访问规则。(service iptables stop)
二、开始配置
命令:vncserver
第一次使用此命令会提示你输入访问口令,两次口令后,vncserver即可正常工作。
可以使用最常用工具VNC Viewer访问远程桌面了。
三、显示图形化界面
不知是出于什么考虑,第二步后无法看到图形化界面,但改起来超简单,修改一个参数就OK了。
用第二步时的用户登录,修改一下VNC的启动文件
vi .vnc/xstartup
将最后一行“twm &”修改为“gnome-session &”
重启vnc服务,kill掉刚才的进程,再新启一个VNC即可。
service vncserver restart
vncserver -kill :1
vncserver
======================================================
Xvnc in Linux RH6.2 problem
When you unzip vnc-3.3.3r1_x86_linux_2.0.tgz a folder called vnc_x86_linux_2.0 is created. First of all, that folder contains a readme file that explains everything I'm about to tell you.:-) There is only a couple of steps that need to be taken in linux before you can ./vncserver.... #1 Make sure that /usr/local/bin is in your path. If it isn't add it to the PATH statement in your .bash_profile. A portion of your .bash_profile could look like this .... PATH=/usr/local/bin:$PATH:$HOME/bin After you save this file you need to have your bash re-read it. Type su -l root. To verify that you path is updated type echo $PATH #2 cd to the vnc_x86_linux_2.0 directory. Type the following cp vncviewer vncserver vncpasswd Xvnc /usr/local/bin #3 If you want to use the Java VNC viewer (http, 58xx) do the following mkdir -p /usr/local/vnc/classes cp classes/* /usr/local/vnc/classes That's It! Get back to /root and type vncserver not ./vncserver you will be prompted for a password. At this point vnc created a .vnc folder in your root directory. You should be able to connect with no problem. Nathan Lenz wrote: > when running(as root):> ./vncserver> > I get the error:> vncserver: couldn't find "Xvnc" on your PATH.> > Is there any simple instructions on installing the vnc server on a default> linux instalation...> > Nathan Lenz> ---------------------------------------------------------------------> To unsubscribe, send a message with the line: unsubscribe vnc-list> to majordomo "at" uk.research.att.com> See also: http://www.uk.research.att.com/vnc/intouch.html > --------------------------------------------------------------------- -- Regards