vnc远程控制

  • 格式:pdf
  • 大小:71.03 KB
  • 文档页数:2

vnc远程控制

今天发现ubuntu⾥⾯有⼀个远程桌⾯查看器,如何⽤呢?

以前⽤过ssh,在这个远程桌⾯查看器就可以设置,通过他登录到⼀台linux主机。⾥⾯还有⼀个vnc选项,这个是什

么,google⼀下....

VNC (Virtual Network Computing)是虚拟⽹络计算机的缩写。VNC是⼀款优秀的远程控制⼯具软件。

⼀、安装服务linux@server:~$ sudo apt-get install vnc4server

⼆、设置vnc密码linux@server:~$ vncpasswd

三、启动vncserverlinux@server:~$ vncserver

New 'server:1 (linux)' desktop is server:1

Creating default startup script /home/linux/.vnc/xstartup

Starting applications specified in /home/linux/.vnc/xstartup

Log file is /home/linux/.vnc/server:1.log #此处有问题,可以查看⽇志⽂件

四、连接到linux主机

打开远程桌⾯查看器,点击连接,协议选项:vnc,主机输⼊linux主机地址:192.168.1.2:1 #后⾯有⼀个:1

如图:

之后会要密码,输⼊刚才设置的就⾏了。

这时会发现有⼀个终端,并没有我的gnome桌⾯,所以改⼀下~/.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 &

x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

x-window-manager &

修改后:#!/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 &x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#x-window-manager & #注释掉

gnome-session & #后加的

重启服务:linux@server:~$ vncserver -kill :1 #杀死原先的服务

Killing Xvnc4 process ID 2238

linux@server:~$ vncserver #启动服务

New 'server:1 (linux)' desktop is server:1

Starting applications specified in /home/linux/.vnc/xstartup

Log file is /home/linux/.vnc/server:1.log

再次连接:

还是不⾏。

修改xinitrc权限sudo chmod a+rwx /etc/X11/xinit/xinitrc

再次连接可以看到桌⾯了。

windows连接到我的linux桌⾯

先下载⼀个vnc之类的软件,我的是 VNC Enterprise Edition

之后安装其中的vnc viewer

运⾏vnc viewer输⼊linux主机的ip地址就可以了。

看看在windows下的截图:1440×900

=====================

补充:2013/3/13

今天终于找⼀台破电脑当服务器了,256M内存,40G硬盘,装上了vnc服务,不过⼀切都是默认设置,打开会出现⼀个⼩窗

⼝。

在⾥⾯wget,firefox等都可以,很⽅便。

⽤ssh wget,关了窗⼝⼀会⼉就断线了,⽤vnc不会^_^

注:vncserver开启vncserver :1 #不需要加sudo,开启的服务由开启⽤户关闭

vncserver -kill :1

如果外⽹访问,需要设置路由跳转:5901端⼝,如果多个5902, 5903 ....