標籤:
這個問題真的是困擾我很久很久了,花了我接近一周的時間,查閱了幾乎網上的所有部落格,google百度都搜遍了,大神也請了好幾回,一直沒有搞定。今天終於自己摸索著完美解決了。
不吹牛的說,本篇部落格絕對是中文網上上解決此問題不多的文章之一。
1. 首先ubuntu系統,建議安裝英文語言的,我裝的是14.04英文語言的。
2. 然後來安裝xubuntu案頭(xfce4): $ sudo apt-get install xubuntu-desktop
3. ubuntu系統預設的是gnome案頭,我們需要先把此案頭卸載(之所以卸載gnome,是因為google出來說xrdp和gnome組件衝突會出現多使用者連結案頭gray blank的情況):$ sudo apt-get autoremove gnome-*
4. 安裝xrdp: $ sudo apt-get install xrdp, $ sudo apt-get install vnc4server tightvncserver
5. 接下來可以參考連結http://askubuntu.com/questions/581979/ubuntu-14-10-multiple-simultaneous-independent-remote-desktop-like-connection(google才能開啟)。
1)建立使用者:$ sudo adduser test1
2)run vnc:$ vncserver, 此步驟將會得到如下:
You will require a password to access your desktops.
Password: Verify:
Creating default startup script /home/test1/.vnc/xstartup Starting applications specified in /home/test1/.vnc/xstartup Log file is /home/test1/.vnc/server1:1.log
3) replace /home/test1/.vnc/xstartup content with below
#!/bin/sh unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS startxfce4 & [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic &
4)建立檔案 /etc/init.d/vncserver,並在vucserver裡面添加以下內容
#!/bin/bash unset VNCSERVERARGS VNCSERVERS="" [ -f /etc/vncserver/vncservers.conf ] && . /etc/vncserver/vncservers.conf prog=$"VNC server" start() { . /lib/lsb/init-functions REQ_USER=$2 echo -n $"Starting $prog: " ulimit -S -c 0 >/dev/null 2>&1 RETVAL=0 for display in ${VNCSERVERS} do export USER="${display##*:}" if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then echo -n "${display} " unset BASH_ENV ENV DISP="${display%%:*}" export VNCUSERARGS="${VNCSERVERARGS[${DISP}]}" su ${USER} -c "cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}" fi done } stop() { . /lib/lsb/init-functions REQ_USER=$2 echo -n $"Shutting down VNCServer: " for display in ${VNCSERVERS} do export USER="${display##*:}" if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then echo -n "${display} " unset BASH_ENV ENV export USER="${display##*:}" su ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1 fi done echo -e "\n" echo "VNCServer Stopped" } case "$1" in start) start [email protected] ;; stop) stop [email protected] ;; restart|reload) stop [email protected] sleep 3 start [email protected] ;; condrestart) if [ -f /var/lock/subsys/vncserver ]; then stop [email protected] sleep 3 start [email protected] fi ;; status) status Xvnc ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac
5)使建立的檔案可執行: $ sudo chmod +x /etc/init.d/vncserver
6) To make vnc desktop sessions allocated for users at start up automatically, create following script in /etc/vncserver
sudo mkdir -p /etc/vncserver
sudo vim /etc/vncserver/vncservers.conf (這裡也可以用gedit進行建立檔案,用vim建立,新增內容後,輸入":" 後輸入wq儲存)。添加以下內容(具體看你有幾個使用者,設定的螢幕解析度多少):
VNCSERVERS="3:test3 2:test2 1:test1" VNCSERVERARGS[1]="-geometry 1024x768" VNCSERVERARGS[2]="-geometry 1024x768"
7)run $ sudo update-rc.d vncserver defaults 99
6. 最後就是reboot了,直接用window的遠端連線,不用tightVNC或者其它遠程平台。
windows下多使用者遠程連結ubuntu系統