亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

VNC介紹及相關(guān)命令總結(jié)

系統(tǒng) 1670 0

What is VNCserver?

VNC stands for Virtual Network Computing. It was originally developed by AT&T as a way to administer machines without using the console. If you have used Windows Terminal Services (RDP) , VNC will seem very familiar.

Why use VNCserver?

In Linux, everything can be done from a shell . However, there may be a time when you need to access the machine as if you were at the console.

Getting Started

You will need several things to get started:
  • root privledges
  • VNC client software (tightVNC, you can download it here .)
  • A good password!
As I mentioned above, this example is done with RHEL, which comes standard with VNCserver installed. To start the vncserver simply invoke the following commands:
      [root@roswell etc]# service vncserver start
Starting VNC server:                                       [  OK  ]
[root@roswell etc]# 
[root@roswell etc]# vncpasswd
Password: 
Verify: 
[root@roswell etc]#
[root@roswell etc]# vncserver

New 'roswell:1 (root)' desktop is roswell:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/roswell:1.log

[root@roswell etc]# 

    


So what did we do there? First, we started the vncserver service. It may or may not have already been running on your system. Next we set a password to access the VNC desktop. When you set the password, you will not see any characters on the screen, and you must enter the password twice. You will only need to do this the very first time you run vncserver. The password will be saved in the Linux filesystem, and you can change it at any time by invoking the vncpasswd command again. Last, to activate the VNC desktop, we simply invoked the vncserver command. Notice the output; the desktop is named "roswell:1" which can also be replaced via the machines IP address.

Connecting

Assuming you already installed TightVNC or another VNC client, enter the desktop name:



You can replace the server name with an IP address if you are logging in from outside your LAN. Remember, if you are using NAT port 5900 must be forwarded to your VNCserver.

VNC介紹及相關(guān)命令總結(jié)

Upon successful connection, you will be prompted for a password. You will then see a terminal screen that will allow you to execute commands:

VNC介紹及相關(guān)命令總結(jié)

VNCserver in Runlevel 5 (KDE or Gnome)

If you are new to linux, running VNC server with a terminal isn't going to do you much good. You might want to have a menu-driven GUI like Windows. No problem. Follow these steps:


First, we are going to assume that VNCserver is running under the root user, as shown with the example above. For this example, I will be editing my VNCserver to enter Gnome. You can specify a KDE desktop if you have KDE installed on your server. Make sure you are in the root directory.
      [root@roswell ~]# ls -a
.                                   cacti-0.8.6c.tar.gz  .gnome2_private     .lftp                  queue.dat          temp
..                                  client.cfg           .gnupg              machinedependent.dat  .recently-used      Templates
.config                             FAHlog-Prev.txt      .gstreamer-0.8      .metacity             .rhn-applet.cache  .themes
.cshrc                              FAHlog.txt           .gtkrc              .mozilla              .rhn-applet.conf   .thumbnails
.bash_history                       Desktop              .fonts.cache-1      .gtkrc-1.2-gnome2     .rnd               .Trash
.bash_logout                        .dmrc                .gconf              .ICEauthority         .mysql_history      scripts
.bash_profile                       .eggcups             .gconfd             .icons                .nautilus          .sh_history
.viminfo                            .bashrc              .bashdevl           .esd_auth             .gnome              php-4.11
.ssh                                .vnc                  cacti-0.8.6c       .gnome2                install.log
[root@roswell ~]# cd .vnc
[root@roswell .vnc]# ls
passwd         roswell:1.pid  roswell:2.pid  roswell:3.pid  roswell:4.pid  roswell:5.pid             roswell.area51.lan:1.pid
roswell:1.log  roswell:2.log  roswell:3.log  roswell:4.log  roswell:5.log  roswell.area51.lan:1.log  roswell.area51.lan:2.log
xstartup
[root@roswell .vnc]# vi xstartup

    


Using vi (vim) to edit the xstartup file, make sure your file matches this one:


      #!/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" &
startx &

    


Notice that the last line is "startx &" as this command will launch Gnome upon login via VNCserver. If you are using a KDE desktop, the line "startkde &" should replace the last line.

VNC相關(guān)命令:vncconfig <wbr>vncpasswd <wbr>vncserver<wbr>vncviewer<br><br><span>1.檢查vnc客戶端(tscleint/vncviewer)和服務(wù)器是否已經(jīng)安裝在你的系統(tǒng)中</span><br><span># rpm -qa|grep vnc</span><br><span>vnc-4.1.2-14.el5_3.1</span><br><span>vnc-server-4.1.2-14.el5_3.1</span><br><span>如果沒有安裝vncviewer,那么運行:</span><br><span># yum install vnc</span><br><span>客戶端我們也可以使用tscleint。</span><br><br><span>2.配置vncserver</span><br><span>vim /etc/sysconfig/vncservers</span><br><span>增加:VNCSERVERS="1:root"</span><br><br><span>3.vncpasswd創(chuàng)建一個vnc的口令</span><br><span>注意這將同時在你的home目錄下,創(chuàng)建一個隱藏的目錄.vnc,其中有一個文件passwd保存著你的vnc口令.</span><br><br><span>4. #service vncserver start</span><br><br><span>5. # vncserver</span> (第一次啟動時,需要指定一個密碼)<br><span>You will require a password to access your desktops.</span><br><span>Password:</span><br><span>Verify:</span><br><span>New 'lpi:1 (root)' desktop is lpi:1</span><br><span>Creating default startup script /root/.vnc/xstartup</span><br><span>Starting applications specified in /root/.vnc/xstartup</span><br><span>Log file is /root/.vnc/lpi:1.log</span><br><br><span>可以以多個用戶身份,啟動多個VNC,共享多個用戶的桌面:</span><br><span># lsof -i:{5901,5904}</span><br><span>COMMAND <wbr>PID USER <wbr><wbr>FD <wbr><wbr>TYPE DEVICE SIZE NODE NAME</wbr></wbr></wbr></wbr></wbr></span><br><span>Xvnc <wbr><wbr><wbr>2373 root <wbr><wbr><wbr>4u <wbr>IPv4 <wbr><wbr>6975 <wbr><wbr><wbr><wbr><wbr><wbr>TCP *:5901 (LISTEN)</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><br><span>Xvnc <wbr><wbr><wbr>4236 test <wbr><wbr><wbr>4u <wbr>IPv4 <wbr>16231 <wbr><wbr><wbr><wbr><wbr><wbr>TCP *:5904 (LISTEN)</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><br><br><span>可以手工指定display#,例如:</span><br><span># vncserver :99</span><br><span>New 'lpi.123.com:99 (root)' desktop is server01.123.com:99</span><br><span>Starting applications specified in /root/.vnc/xstartup</span><br><span>Log file is /root/.vnc/server01.123.com:99.log</span><br><br><span>6.停止 vncserver(vncserver -kill :display#): <wbr></wbr></span><br><span># vncserver -kill :1</span><br><span>Killing Xvnc process ID 2373</span><br><br><span>7.設(shè)置自動運行:ntsysv</span><br><br><span>8.VNC給瀏覽器的端口是5800+N,給vncviewer的端口是5900+N,N是設(shè)置的display號</span><br><span>http://192.168.1.1:5801/</span><br><span>ultravnc:192.168.1.1:5901</span><br><span># lsof -i:5801,5901</span><br><span>COMMAND <wbr><wbr>PID USER <wbr><wbr>FD <wbr><wbr>TYPE DEVICE SIZE NODE NAME</wbr></wbr></wbr></wbr></wbr></wbr></span><br><span>Xvnc <wbr><wbr><wbr>31742 root <wbr><wbr><wbr>4u <wbr>IPv4 <wbr>51969 <wbr><wbr><wbr><wbr><wbr><wbr>TCP *:5901 (LISTEN)</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><br><span>Xvnc <wbr><wbr><wbr>31742 root <wbr><wbr><wbr>5u <wbr>IPv4 <wbr>51970 <wbr><wbr><wbr><wbr><wbr><wbr>TCP *:5801 (LISTEN)</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><br><br><span>9.修改VNC密碼</span><br><span># vncpasswd /root/.vnc/passwd</span><br><span>Password:</span><br><span>Verify:</span><br><br><span>VNC日志文件位于:$HOME/.vnc下的log文件,此目錄也包含了一個VNC的xstartup啟動文件。</span><br><br><span style="font-weight:bold">以GNOME方式顯示,修改xstartup文件</span><br><span style="color:#033cc">#!/bin/sh</span><br style="color:rgb(0,51,204)"><br style="color:rgb(0,51,204)"><span style="color:#033cc"># Uncomment the following two lines for normal desktop:</span><br style="color:rgb(0,51,204)"><span style="color:#033cc">unset SESSION_MANAGER</span><br style="color:rgb(0,51,204)"><span style="color:#033cc">exec /etc/X11/xinit/xinitrc</span><br style="color:rgb(0,51,204)"><br style="color:rgb(0,51,204)"><span style="color:#033cc">[ -x /etc/vnc/xstartup ] &amp;&amp; exec /etc/vnc/xstartup</span><br style="color:rgb(0,51,204)"><span style="color:#033cc">[ -r $HOME/.Xresources ] &amp;&amp; xrdb $HOME/.Xresources</span><br style="color:rgb(0,51,204)"><span style="color:#033cc">xsetroot -solid grey</span><br style="color:rgb(0,51,204)"><span style="color:#033cc">vncconfig -iconic &amp;</span><br style="color:rgb(0,51,204)"><span style="color:#033cc">xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &amp;</span><br style="color:rgb(0,51,204)"><span style="color:#033cc">gnome-session &amp;</span><br><span># tsclient</span><br><span>出現(xiàn)錯誤:unable to connect to host: Connection refused (111)</span><br><span>一般是沒有指定連接的display#,例如地址輸入:192.168.1.1出錯,192.168.1.1:1就正確了<br> VNCserver auto run<br></span><span style="background-color:#ffff00"><span>啟動vncserver服務(wù)時,出現(xiàn)no displays configured :此錯誤,請編輯vncservers文件</span><br><span>#vim /etc/sysconfig/vncservers</span><br><span style="color:#033cc"># The VNCSERVERS variable is a list of display:user pairs.</span><br style="color:rgb(0,51,204)"><span style="color:#033cc">#</span><br style="color:rgb(0,51,204)"><span style="color:#033cc"># Uncomment the lines below to start a VNC server on display :2</span><br style="color:rgb(0,51,204)"><span style="color:#033cc"># as my 'myusername' (adjust this to your own). <wbr>You will also</wbr></span><br style="color:rgb(0,51,204)"><span style="color:#033cc"># need to set a VNC password; run 'man vncpasswd' to see how</span><br style="color:rgb(0,51,204)"><span style="color:#033cc"># to do that. <wbr></wbr></span><br style="color:rgb(0,51,204)"><span style="color:#033cc">#</span><br style="color:rgb(0,51,204)"><span style="color:#033cc"># DO NOT RUN THIS SERVICE if your local area network is</span><br style="color:rgb(0,51,204)"><span style="color:#033cc"># untrusted! <wbr>For a secure way of using VNC, see</wbr></span><br style="color:rgb(0,51,204)"><span style="color:#033cc"># &lt;URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html&gt;.</span><br style="color:rgb(0,51,204)"><br style="color:rgb(0,51,204)"><span style="color:#033cc"># Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.</span><br style="color:rgb(0,51,204)"><br style="color:rgb(0,51,204)"><span style="color:#033cc"># Use "-nohttpd" to prevent web-based VNC clients connecting.</span><br style="color:rgb(0,51,204)"><br style="color:rgb(0,51,204)"><span style="color:#033cc"># Use "-localhost" to prevent remote VNC clients connecting except when</span><br style="color:rgb(0,51,204)"><span style="color:#033cc"># doing so through a secure tunnel. <wbr>See the "-via" option in the</wbr></span><br style="color:rgb(0,51,204)"><span style="color:#033cc"># `man vncviewer' manual page.</span><br style="color:rgb(0,51,204)"><br style="color:rgb(0,51,204)"><span style="color:#033cc">VNCSERVERS="1:root"</span><br style="color:rgb(0,51,204)"><span style="color:#033cc">VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"</span></span></wbr></wbr></wbr>

VNC介紹及相關(guān)命令總結(jié)


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 精品一区二区三区在线视频 | 91精品免费观看老司机 | 波多野给衣一区二区三区 | 欧美日韩福利视频一区二区三区 | er久99久热只有精品国产 | 精品久久久中文字幕二区 | 在线成人欧美 | 国产一级特黄高清在线大片 | 啪啪免费网站入口链接 | 九九影院理论片私人影院 | 99r在线视频 | 欧美成人一区二区三区 | 夜夜夜爽爽爽久久久 | 国产一区二区三区在线影院 | 中文字幕国产亚洲 | 九九福利| 四虎免费影院4hu永久免费 | 精品久久久久久中文字幕无碍 | 欧美日本一本线在线观看 | 日日草夜夜操 | 奇米影视778成人四色狠狠 | 日本边添边爱边做视频 | 久草首页在线 | 欧美精品福利在线视频 | 看全色黄大色大片免费久黄久 | 日韩精品一区二三区中文 | 亚洲九九夜夜 | 亚洲精品伊人 | 伊人网综合视频 | 一级aa免费视频毛片 | 日本一二三区视频 | 日韩欧美视频免费观看 | 人人艹在线 | 美女黄www视频 | 国产网红自拍 | 综合在线视频精品专区 | 亚洲精品福利一区二区 | 成人午夜视频在线播放 | 俺去久久 | 中文字幕日韩亚洲 | 久久国产精品夜色 |