1、启动vncserver
:
Vncserver start
[root@zhou .vnc]# vncserver
start
You will require a password to access
your desktops.
Password:
Verify:
usage: vncserver
[:] [-nohttpd] [-name
] [-depth
]
[-geometry
x]
[-pixelformat rgbNNN|bgrNNN]
...
vncserver -kill
第一次启动vncserver 系统会提示你输入密码;若不是第一次登入vncserver 可以通过把/root/.vnc/passwd 删除。再次运行vncserver start。
2、通过VNC Viewer
登入系统(命令行界面)
[root@zhou .vnc]# vncserver
:1
New ':1 (root)' desktop is
:1
Starting applications specified in
/root/.vnc/xstartup
Log file is
/root/.vnc/:1.log
3、通过VNC Viewer
登入系统(图形化界面)
修改/root/.vnc/xstartup
[root@zhou .vnc]# vi 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
&
gnome-session
&
~
[root@zhou .vnc]# vncserver -kill
:1
Killing Xvnc process ID
17929
[root@zhou .vnc]# ls
-l
总计 40
-rw------- 1 root root
8 08-15 10:14 passwd
-rwxr-xr-x 1 root root 352
08-15 10:24 xstartup
-rw-r--r-- 1 root root 1301 08-15 10:26
:1.log
-rw-r--r-- 1 root root 27113 08-15
08:21 :2.log
[root@zhou .vnc]# vncserver
:1
New ':1 (root)' desktop is
:1
Starting applications specified in
/root/.vnc/xstartup
Log file is
/root/.vnc/:1.log
4、关闭vncserver
[root@zhou ~]# vncserver
:1
New ':1 (root)' desktop is
:1
Starting applications specified in
/root/.vnc/xstartup
Log file is
/root/.vnc/:1.log
[root@zhou ~]# ps aux | grep
vnc
root
10897
1.1
0.6
11556 7268
pts/1
S
04:13
0:00 Xvnc :1 -desktop :1 (root) -httpd
/usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024x768
-depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901
-pn
root
10901
0.1
0.1
4276 1308
pts/1
S
04:13
0:00 vncconfig -iconic
root
11009
0.0
0.0
3924 664
pts/1
R+
04:13
0:00 grep vnc
[root@zhou ~]# vncserver -kill
:1
Killing Xvnc process ID
10897
[root@zhou ~]# ps aux | grep
vnc
root
11025
0.0
0.0
3924 688
pts/1
R+
04:14
0:00 grep vnc
[root@zhou ~]#
##############################################################
服务器典型配置
[root@ytxt ~]# cat ~/.vnc/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 &
gnome-session &