Remote Desktop 遠端桌面
RDP, VNC, NX Fress, X2Go
XRDP
安裝
# Ubuntu 18.04
sudo apt-get install xrdp xfce4
echo xfce4-session >~/.xsession
# 檢查 XRDP 是否已啟動
# 檢查 port 3389 是否開啟
sudo netstat -ltpn
# XRDP 服務啟動/關閉
sudo systemctl stop xrdp-sesman
sudo systemctl start xrdp-sesman
TIP:
- 不需設定 vncserver 密碼
- 預設 port 是 3389,若要變更,可修改 /etc/xrdp/xrdp.ini
Windows 用戶端登入時
- 選擇 sesman-Xvnc
- 輸入 Ubuntu 的系統帳號/密碼
FAQ
Q: 在 Ubuntu 13/14 遠端連線後出現空白畫面
Ans: 這是因為 XRDP 與 Gnome 套件有衝突,解決方法只能將桌面程式改成 XFACE,步驟如下:
sudo add-apt-repository ppa:xubuntu-dev/xfce-4.10
sudo apt-get update
sudo apt-get install xfce4
echo xfce4-session >~/.xsession
sudo service xrdp restart
Tutorials
- Using Windows to Create and Access a Remote Ubuntu Desktop
- How to Configure Remote Desktop on Ubuntu Server
VNC
Ubuntu 9/11
sudo apt-get install ubuntu-desktop --no-install-recommends
sudo apt-get install vnc4server
編輯 .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 &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session & # support for GNOME
startkde $ #support for KDE
Lubuntu
編輯 .vnc/xstartup
/usr/bin/lxsession -s Lubuntu -e LXDE
CentOS
CentOS 6:
yum groupinstall Desktop
yum install tigervnc tigervnc-server
設定 VNC 密碼
vncserver
編輯 ~/.vnc/xstartup
# 移除註解
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
設定開機後自動啟動
/etc/sysconfig/vncservers
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1280x1024" #這行可不加
chkconfig vncserver on
CentOS 5:
# Install
yum install vnc-server
# Set the password for vnc
vncserver
/root/.vnc/xstartup
xsetroot -solid grey
vncconfig -iconic &
gnome-session & # 加這行
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & # 註解這行
#twm & # 註解這行
重啟 vncserver
vncserver -kill :1
vncserver
畫面解析太小
vncserver -geometry 1280x960
Learning
- How to install and access CentOS remote desktop on VPS
- How to Access Remote Desktop from Browser Using TightVNC
- [GitHub] KasmVNC - Modern VNC Server and client, web based and secure
NX free edition
官網:https://www.nomachine.com/download
安裝
下載 3 個安裝檔
- nxclient_3.5.0-7_i386.deb
- nxnode_3.5.0-7_i386.deb
- nxserver_3.5.0-9_i386.deb
sudo dpkg -i nxclient_3.5.0-7_i386.deb
sudo dpkg -i nxnode_3.5.0-7_i386.deb
sudo dpkg -i nxserver_3.5.0-9_i386.deb
Windows 用戶端
下載 NX Client for Windows
X2Go
特色
- 可多人登入
- 可播放影片
- 資源耗用較少
- 登入使用 SSH 帳號
- NX-based remote desktop solutions
X2Go Server
sudo apt-add-repository ppa:x2go/stable
sudo apt-get update
sudo apt-get install x2goserver x2goserver-xsession
sudo apt-get install x2gomatebindings
sudo apt-get install xfce4 xfce4-terminal
sudo apt-get install gnome-icon-theme tango-icon-theme
X2Go Client
sudo apt-add-repository ppa:x2go/stable
sudo apt-get update
sudo apt-get install x2goclient
Learning
- X2Go - everywhere@home
- How to install X2Goserver on Ubuntu 14.04 as an alternative for VNC
- How to set up remote desktop on Linux VPS using x2go
Guacamole
Apache Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH.
Home: https://guacamole.apache.org/
- Access your computers from anywhere
Because the Guacamole client is an HTML5 web application, use of your computers is not tied to any one device or location. As long as you have access to a web browser, you have access to your machines. - Keep your desktop in the cloud
Desktops accessed through Guacamole need not physically exist. With both Guacamole and a desktop operating system hosted in the cloud, you can combine the convenience of Guacamole with the resilience and flexibility of cloud computing. - Free and open source
Apache Guacamole is and will always be free and open source software. It is licensed under the Apache License, Version 2.0, and is actively maintained by a community of developers that use Guacamole to access their own development environments.
We feel this sets us apart from other remote desktop solutions, and gives us a distinct advantage. - Built on a well-documented API
Apache Guacamole is built on its own stack of core APIs which are thoroughly documented, including basic tutorials and conceptual overviews in the online manual. These APIs allow Guacamole to be tightly integrated into other applications, whether they be open source or proprietary.
Installation
With Docker
docker-compose.yml:
version: "3"
services:
guacamole:
image: jwetzell/guacamole
container_name: guacamole
volumes:
- ./postgres:/config
ports:
- 8880:8080
volumes:
postgres:
driver: local
Login with the default credentials of:
- username: guacadmin
- password: guacadmin
More available extensions:
- auth-ldap - LDAP Authentication
- auth-duo - Duo two-factor authentication
- auth-header - HTTP header authentication
- auth-cas - CAS Authentication
- auth-openid - OpenID Connect authentication
- auth-totp - TOTP two-factor authentication
- auth-quickconnect - Ad-hoc connections extension
Usage:
docker run \
-p 8080:8080 \
-v </path/to/config>:/config \
-e "EXTENSIONS=auth-ldap,auth-duo" \
jwetzell/guacamole
Authentications
Google two-factor
With docker-compose
version: "3"
services:
guacamole:
...
environment:
- EXTENSIONS=auth-totp
...
SSH
SSH-Key Authentication
# Generate the private key and public key
# NOTE: -m PEM is required for Guacamole
ssh-keygen -t rsa -b 4096 -f ~/.ssh/root@guacamole -C "root@guacamole" -m PEM
複製與貼上
預設環境遠端主機的文字可以複製,然後在本地端作貼上;不過,本地端文字無法複製後在遠端主機作貼上,解決方法如下:
在遠端主機的畫面,按下 Ctrl + Alt + Shift,會彈出 Guacamole 選單,將本地端文字貼在選單裡的 Clipboard,回到遠端主機,直接執行貼上即可。
Learning
- Access Your Computer From Anywhere Via Web Browser using Apache Guacamole
- Install and Use Guacamole Remote Desktop on CentOS 8
- [Video] Guacamole Remote Desktop - Open Source, Self Hosted remote access to your machines in the browser!
- [Video] Meet Guacamole, Your Remote Access Gateway
- [Video] Securely Access any PC or VM Remotely using only a Web Browser with Guacamole
Learning
- 11 Best Tools to Access Remote Linux Desktop
- Get Started With Ubuntu Remote Desktop: What is It & How to Use It
- [GitHub] neko - A self hosted virtual browser that runs in docker and uses WebRTC.
- [Video] Remote Desktop & Access Tools comparison between 4 great open source, self hosted options!
Webtop
Meet Webtops A Linux Desktop Environment In Your Browser
SPICE (Proxmox VE is required)
The SPICE project aims to provide a complete open source solution for remote access to virtual machines in a seamless way so you can play videos, record audio, share usb devices and share folders without complications.
Kasm Workspace
Kasm Workspace Community Edition - Kasm Workspaces CE is a no-cost version of the Professional/Enterprise container streaming platform for individual users, non-profit organizations, and businesses wanting to test the platform. Workspaces CE has nearly all the same features as the paid versions with community based support.