Linux下VNC配置多个桌面和修改密码
2011-12-01 09:07阅读:
1、安装VNC服务
第一步:在linux系统盘的Packages文件夹中找到以‘tigervnc’开头的两个安装文件拷贝到/data目录下;
如下两个文件:
tigervnc-server-1.1.0-24.el6.x86_64
tigervnc-1.1.0-24.el6.x86_64
第二步:root用户登录系统,在终端命令行进入/data目录——>输入命令
:rpm -ivh tigervnc-server-1.1.0-24.el6.x86_64
回车,安装。
第三步:root用户登录系统,在终端命令行进入/data目录——>输入命令
:tigervnc-1.1.0-24.el6.x86_64
回车,安装。
2、配置VNC自启动服务
注:自启动服务就是在系统重新启动后,VNC服务会自动启动
root用户登录系统,在终端命令行 chkconfig
--level 345 vncserver on
就可以加入自启动服务了。
3、配置VNC服务
第一步:root用户登录系统,在终端命令行输入vi
/etc/sysconfig/vncservers 回车
第二步:按i建进入编辑,在最末端加入每一个用户的配置信息,注意每个用户有不同
的桌面配置号,一定不要相同。如下配置:
# VNCSERVERS='2:myusername'
# VNCSERVERARGS[2]='-geometry 800x600 -nolisten tcp
-localhost'
VNCSERVERS='2:root 3:ymx 4:wjx 5:wxy'
VNCSERVERARGS[2]='-geometry 1360x768'
VNCSERVERARGS[3]='-geometry 1364x768'
VNCSERVERARGS[4]='-geometry 1362x768'
VNCSERVERARGS[5]='-geometry 1362x768'
说明:’1、2:root 3:ymx 4:wjx 5:wxy’中的‘2
3 4 5’
是为每一个用户桌面号,和[2]、[3]、[4]、[5]对应;
2、[2]、[3]、[4]、[5]为桌面号,编写时要一一对应
3、1360 X 768是分配的默认分辨率,可不同
第三步:编辑完毕后,按esc键——>按shift + X
键,回车保持配置。
4、关闭selinux
第一步root用户登录系统,在终端命令行输入vi /etc/sysconfig/selinux
回车
第二步:按i建进入编辑, 更改SELINUX=disabled
# This file controls the state of SELinux on
the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is
enforced.
# permissive - SELinux prints warnings
instead of enforcing.
# disabled - No SELinux policy is
loaded.
SELINUX=disabled 修改这个地方
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are
protected,
# mls - Multi Level Security
protection.
SELINUXTYPE=targeted
第三步:编辑完毕后,按esc键——>按shift + X
键,回车保持配置。
5、重启服务器让所有配置生效
root用户登录系统,在终端命令行输入reboot
回车,系统重启。
6、配置VNC每一个用户的VNC登录密码
注:要对每一个用户进行设置,设置前要用第一步的命令su –
ymx进入用户shell下(ymx是用户名)
第一步:执行su -ymx命令
第二步:执行vncpasswd命令,对ymx用户进行设置VNC登录密码,输入两边密码。
重复以上两步对其它用户进行VNC登录密码设置
7、重启VNC服务
root用户登录系统,在终端命令行输入service vncserver restart
回车重新启动VNC服务
8、查看每个用户的登录端口,并加入防火墙
第一步:root用户登录系统,在终端命令行输入ps -ef |gre vnc
回车
root 2230 1
0 19:00 ? 00:00:00
/usr/bin/Xvnc :2 -desktop localhost.localdomain:2 (root) -auth
/root/.Xauthority -geometry 1360x768 -rfbwait 30000 -rfbauth
/root/.vnc/passwd -rfbport 5902 -fp
catalogue:/etc/X11/fontpath.d -pn
root 2237 2235
0 19:00 ? 00:00:00
vncconfig -iconic
ymx 2304 1
0 19:00 ? 00:00:01
/usr/bin/Xvnc :3 -desktop localhost.localdomain:3 (ymx) -auth
/home/ymx/.Xauthority -geometry 1364x768 -rfbwait 30000 -rfbauth
/home/ymx/.vnc/passwd -rfbport 5903 -fp
catalogue:/etc/X11/fontpath.d -pn
ymx 2478 2475
0 19:00 ? 00:00:00
vncconfig -iconic
wjx 2563 1
0 19:00 ? 00:00:01
/usr/bin/Xvnc :4 -desktop localhost.localdomain:4 (wjx) -auth
/home/wjx/.Xauthority -geometry 1364x768 -rfbwait 30000 -rfbauth
/home/wjx/.vnc/passwd -rfbport 5904 -fp
catalogue:/etc/X11/fontpath.d -pn
wjx 2672 2666
0 19:01 ? 00:00:00
vncconfig -iconic
wxy 2765 1
0 19:01 ? 00:00:01
/usr/bin/Xvnc :5 -desktop localhost.localdomain:5 (wxy) -auth
/home/wxy/.Xauthority -geometry 1364x768 -rfbwait 30000 -rfbauth
/home/wxy/.vnc/passwd -rfbport 5905 -fp
catalogue:/etc/X11/fontpath.d -pn
wxy 2860 2853
0 19:01 ? 00:00:00
vncconfig -iconic
root 4389 4333
0 19:16 pts/0 00:00:00 grep vnc
第二步:记录好对应的端口号
注:有多少个端口,要在防火墙加入多少个端口,每个用于一个端口。
输入下面的命令: