配置VNCserver的教程
主要参考文章
http://blog.51766.com/comments/zsc/Weblog/1148650408392
http://blog.51766.com/comments/zsc/Weblog/1148650408392
room根用户登录在/root目录下
#rpm -q vnc vnc-server查询已安装vnc的客户端和服务器端
vnc-4.1.1-36
vnc-server-4.1.1-36
#vi /etc/sysconfig/vncservers将fangfang用户名加入vncservers文件中
如下所示:
如下所示:
# VNCSERVERS="2:myusername"
VNCSERVERS="2:fangfang"
VNCSERVERS="2:fangfang"
创建一个vnc的口令
#vncpasswd
Password:
Verify:
#vncpasswd
Password:
Verify:
启动vnc服务
#sudo /sbin/service vncserver start
Starting VNC server:2:fangfang [FAILED]
#sudo /sbin/service vncserver start
Starting VNC server:2:fangfang [FAILED]
后来改为用户fangfang,并在/home/fangfang目录下创建vnc的口令
[fangfang@fangfang ~]$vncpasswd
Password:
Verifty:
[fangfang@fangfang ~]$vncpasswd
Password:
Verifty:
$ls -d .vnc
.vnc
$ls .vnc
passwd
.vnc
$ls .vnc
passwd
$/sbin/service vncserver start
Starting VNC server:2:fangfang runuser:cannot set groups:Operation not permitted
[FAILED]
$sudo /sbin/service vncserver start
fangfang is not in the sudorers file.This incident will be reported.
退出仍用root用户
#sudo /sbin/service vncserver start
Starting VNC server:2:fangfang xauth:creating new authority file /home/fangfa
ng/.Xauthority
Starting VNC server:2:fangfang runuser:cannot set groups:Operation not permitted
[FAILED]
$sudo /sbin/service vncserver start
fangfang is not in the sudorers file.This incident will be reported.
退出仍用root用户
#sudo /sbin/service vncserver start
Starting VNC server:2:fangfang xauth:creating new authority file /home/fangfa
ng/.Xauthority
New 'fangfang.fw:2(fangfang)'desktop is fangfang.fw:2
Creating default startup script /home/fangfang/.vnc/xstartup
Starting applications specified in /home/fangfang/.vnc/xstartup
Log file is /home/fangfang/.vnc/fangfang.fw:2.log
[OK]
这次成功了.
Starting applications specified in /home/fangfang/.vnc/xstartup
Log file is /home/fangfang/.vnc/fangfang.fw:2.log
[OK]
这次成功了.
#cd .vnc (/home/fangfang/下)
#ls
fangfang.fw:2.log fangfag.fw:2.pid passwd xstartup
#vi xstartup
下面两行的注释去掉。
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
保存退出
重启vncserver
#sudo /sbin/service vncserver restart
Shutting down VNC server:2:fangfang [OK]
Starting VNC server:2:fangfang
New 'fangfang.fw:2(fangfang)'desktop is fangfang.fw:2
#ls
fangfang.fw:2.log fangfag.fw:2.pid passwd xstartup
#vi xstartup
下面两行的注释去掉。
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
保存退出
重启vncserver
#sudo /sbin/service vncserver restart
Shutting down VNC server:2:fangfang [OK]
Starting VNC server:2:fangfang
New 'fangfang.fw:2(fangfang)'desktop is fangfang.fw:2
Starting application specified in /home/fangfang/.vnc/xstartup
Log file is /home/fangfang/.vnc/fangfang.fw:2.log
[OK]
Log file is /home/fangfang/.vnc/fangfang.fw:2.log
[OK]
在本机上试连接到vncserver
#vncviewer localhost:2
成功,打开了一个vnc窗口,输入口令,进入。
#vncviewer localhost:2
成功,打开了一个vnc窗口,输入口令,进入。
客户端的配置
如客户端为windows ,用putty详见SSH配置一文
客户端为linux:
1.vncviewer localhost:2 在本机执行
2.用ssh
1.vncviewer localhost:2 在本机执行
2.用ssh
ssh -L 5901:localhost:5901 -l foo myserver
需在sudo vi /etc/sysconfig/iptables中打开5901端口,
然后重启iptables
sudo /sbin/service iptables restart
然后重启iptables
sudo /sbin/service iptables restart
或者直接用ip地址
ssh -L 5901:localhost:5901 -l foo 192.168.x.x
本文地址:http://www.45fan.com/a/question/69821.html