so_brave 发表于 2011-12-11 20:51

linux下vncserver配置

linux下vncserver配置












一.
运行vncserver命令,如果第一次配置VNC Server,会要求提供登录VNC使用的密码.以后也可以使用vncpasswd来修改密码.
$ vncserver




You will require a password to access your desktops.




Password:123456


Verify:123456


xauth:
creating new authority file /root/.vnc/.Xauthority




New 'xok.la.localdomain:1 (test)' desktop is xok.la.localdomain:1




Creating default startup script /root/.vnc/xstartup


Starting applications specified in /root/.vnc/xstartup


Log file is /root/.vnc/xok.la.localdomain:1.log此时就可以在Windows使用VNC viewer登录了

输入服务器地址:192.168.0.64:1

然后提示输入密码,输入你刚才设定的密码就好了,如123456



注意:IP地址后面的:1的意思是linux上面VNC设定的Display No.每运行一个vncserver就会多创建一个Display,Display No也就会加一.

虽然此时可以登录,但是登录后看到的界面是X term的界面,还不是正常的X Window界面,我们要修改配置,使之使用X Window



二.修改配置文件/root/.vnc/xstartup,使之与下面内容相同
$ cat 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 &三.保存文件,在终端中输入vncserver,让VNC打开一个新的Display


然后就看到你想要的界面了吧.

以后如果服务器重新启动后,要重新输入vncserver后登录.如果服务器一直开机,就不用了(但密码不会变。).



如果要杀掉vncserver 进程,可执行vncserver -kill :1表示display的ID号

蓝猫淘气啦啦 发表于 2011-12-21 22:54

谢谢分享希望于楼主多多交流
页: [1]
查看完整版本: linux下vncserver配置