亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2205 | 回復: 0
打印 上一主題 下一主題

用vnc實現(xiàn)遠程桌面連接 [復制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2009-11-05 12:04 |只看該作者 |倒序瀏覽

VNC是Virtual Network Computing的簡稱,可以跨平臺實現(xiàn)遠程桌面連接,比如windows系統(tǒng)連接linux桌面。
1、檢查是否安裝了vnc server
[tchung@tchung101 tchung]$ rpm -q vnc vnc-server
vnc-4.0-0.beta4.3.2
vnc-server-4.0-0.beta4.3.2
[tchung@tchung101 tchung]$
2、在配置文件中添加上用戶名
[tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the line below to start a VNC server on display :1
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# URL:http://www.uk.research.att.com/vnc/sshvnc.html
# VNCSERVERS="1:myusername"
VNCSERVERS="1:tchung"
3、設(shè)置密碼
在啟動vnc服務之前,先用vncpasswd命令建一個密碼。將有一個隱藏的.vnc文件夾在/home下,文件名為passwd,這個文件內(nèi)有你設(shè)置的密碼。
[tchung@tchung101 tchung]$ vncpasswd
                          Password:
                          Verify:
[tchung@tchung101 tchung]$ ls -d .vnc .vnc                           [tchung@tchung101 tchung]$ ls .vnc passwd
4、啟動vnc service
[tchung@tchung101 tchung]$ sudo /sbin/service vncserver start
Starting VNC server: 1:tchung                              [  OK  ]
[tchung@tchung101 tchung]$
現(xiàn)在查看一下 .vnc 文件夾,是否有以下內(nèi)容
[tchung@tchung101 tchung]$ cd .vnc
[tchung@tchung101 .vnc]$ ls
passwd  tchung101:1.log  tchung101:1.pid  xstartup
[tchung@tchung101 .vnc]$
如果你編輯了xstartup, 注意下面的紅字.
Uncomment those two lines in red as shown below!!! Otherwise, you will get nothing but grey screen.
#!/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 &
5、連接
編輯vnc startup script之后,得重啟vncserver.
[tchung@tchung101 tchung]$ sudo /sbin/service vncserver restart Shutting down VNC server: 1:tchung [ OK ]
Starting VNC server: 1:tchung [ OK ]
[tchung@tchung101 tchung]$ So how do I connect to vncserver? Use vncviewer command in vnc client as following.
[tchung@tchung101 tchung]$ vncviewer localhost:1

Enter your vnc password and here is the result:
Screenshot
UPDATE:
要連接一個有防火墻的服務器,必須打開端口5901。
Add following line in red to open port 5901 and restart iptables service.
[tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/iptables
# Firewall configuration written by redhat-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT – [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp –icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT –reject-with icmp-host-prohibited
COMMIT
[tchung@tchung101 tchung]$ sudo /sbin/service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
建立兩個用戶連接的方法
VNCSERVERS=”1:tchung 2:thomasc” You will, of course have to run vncpasswd for both users. Also in your firewall update, you may want to clarify that VNC uses port 5901 for connection 1. If you had both users above, you would have to have ports 5901 and 5902 open.
[注: 1:tchung 對應的端口號是5901,2:thomasc對應的端口號是2902]



本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u/31839/showart_2086905.html
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP