在Linux的環境中,想要遠端開啟桌面時,通常所使用的都是VNC,但是這VNC遠端桌面實在是不太好用,不僅操作上會有延遲的感覺,更重要的是VNC Server免費版本是沒有加密功能的。
在網路上看了一些文章,總算看到一個解決方法,就是使用xrdp,開放原始碼的遠端桌面通訊協定(remote desktop protocol)伺服器。使用xrdp後就可以利用Windows上的「遠端桌面連線」來看到Linux上的桌面唷!
事前準備:首先先到http://www.xrdp.org/下載xrdp,並將檔案上傳至Linux Server
(此範例所使用的系統是Red Hat Enterprise Linux 6.3,xrdp版本是0.5.0)
1、修改檔案權限
#chmod 777 /home/kelvin/xrdp-0.5.0-0.13.el6.x86_64.rpm
2、安裝xrdp
#rpm -ivh /home/kelvin/xrdp-0.5.0-0.13.el6.x86_64.rpm
warning: /home/kelvin/xrdp-0.5.0-0.13.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:xrdp ########################################### [100%]
3、啟動xrdp
#service xrdp start
Starting xrdp: [ OK ]
Starting xrdp-sesman: [ OK ]
4、設定vnc(此範例是使用kelvin來當作執行vnc server的使用者)
#vim /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# 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 this URL:
# http://kbase.redhat.com/faq/docs/DOC-7028
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="2:kelvin"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
5、切換到kelvin這個user並設定vnc密碼(密碼需輸入兩次)
#su - kelvin -c vncpasswd
Password:
Verify:
6、啟動vnc server
#service vncserver start
Starting VNC server: 2:kelvin
New 'DAP-C:2 (kelvin)' desktop is DAP-C:2
Starting applications specified in /home/kelvin/.vnc/xstartup
Log file is /home/kelvin/.vnc/DAP-C:2.log
[ OK ]
7、設定開機時自動啟動vnc server
#chkconfig vncserver on
8、設定開機時自動啟動xrdp
#chkconfig xrdp on
9、確認設定結果:開機時vnc server與xrdp是否會自動啟動
#chkconfig vncserver --list
vncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off
#chkconfig xrdp --list
xrdp 0:off 1:off 2:on 3:on 4:on 5:on 6:off
以上都設定完畢後,就可以在Windows上開啟「遠端桌面連線」來試驗看看是不是設定成功了,看見以下畫面就代表成功囉。
留言列表