一、在Linux服务器中,我们通常是通过ssh进行远程操作,偶尔需要有桌面支持或图形化安装相关软件时,则需要远程到服务器桌面或将输出图形调到客户端。
Linux下的远程工具通常用到的有xmanager、vnc。以下将简单介绍vnc的应用。
step1:安装vnc并启动vnc
[root@ ~]# rpm -qa |grep vnc #需安装以下两个包
vnc-4.1.2-14.el5_6.6
vnc-server-4.1.2-14.el5_6.6
[root@ ~]# service vncserver start #启动vnc服务
Starting VNC server: no displays configured [ OK ]
step2:修改 /etc/sysconfig/vncservers 配置文件,添加tghfly和test用户,设置会话窗口,并使用gnome桌面
[root@ ~]# grep -v "#" /etc/sysconfig/vncservers
VNCSERVERS="1:tghfly 2:test" #1表示登录会话窗口,tghfly表示登录用户
VNCSERVERARGS[1]="-geometry 1280x768" #远程桌面窗口大小为1280x768
VNCSERVERARGS[2]="-geometry 1280x768"
step3:创建系统用户tghfly和test,并设置密码
[root@ ~]# useradd tghfly
[root@ ~]# passwd tghfly
Changing password for user tghfly.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@ ~]# useradd test
[root@ ~]# passwd test
Changing password for user test.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
step4:切换到tghfly和test,设置远程登录密码,生成远程认证文件
[root@ ~]# su - tghfly
[@linuxidc ~]$ vncserver #使用vncserver设置当前用户远程登录密码
You will require a password to access your desktops.
Password:
Verify:
xauth: creating new authority file /home/tghfly/.Xauthority
New 'hongwb.com.cn:1 (tghfly)' desktop is hongwb.com.cn:1
Creating default startup script /home/tghfly/.vnc/xstartup
Starting applications specified in /home/tghfly/.vnc/xstartup
Log file is /home/tghfly/.vnc/hongwb.com.cn:1.log