Follow these steps :
Step 1 – Install xRDP
Open Terminal (Crtl+Alt+T) and execute the following commands:
sudo apt-get update sudo apt-get install xrdp
Step 2 – Install XFCE4 ( Unity doesn't seem to support xRDP in Ubuntu 14.04; although, in Ubuntu 12.04 it was supported ). That's why we install Xfce4.
sudo apt-get install xfce4
Step 3 – Configure xRDP
In this step, we modify two files to make sure xRDP uses Xfce4. First we need to create, or edit, our
.xsession
file in our home directory. We can either use nano or simply redirect an echo statement (easier):echo xfce4-session > ~/.xsession
The second file we need to edit is the startup file for xRDP, so it will start Xfce4.
sudo nano /etc/xrdp/startwm.sh
The content should look like this (pay attention to the last line and ignore
. /etc/X11/Xsession
):#!/bin/sh if [ -r /etc/default/locale ]; then . /etc/default/locale export LANG LANGUAGE fi startxfce4
Step 4 – Restart xRDP
To make all these changes effective, restart xRDP as such:
sudo service xrdp restart
Testing your xRDP connection
On the computer that will remotely control your Ubuntu machine, start you RDP client. Windows comes standard with a Remote Desktop client (mstsc.exe – you can start it from a command prompt, or find the shortcut to Remote Desktop under Accessories). Or Search 'remote' in start (Windows 7) Or 'remote' in search box in Windows 8.
Whichever client you use, most will work with either the computer network name or IP address of your Ubuntu machine.
To find the IP address on your Ubuntu box, type:
hostname -I
(note: this is a capital “i”)
Enter IP address of your Ubuntu machine. For example:
Depending on your RDP client capabilities and settings (for example: Microsoft RDP Client allows automatic login), you might or might not see the login screen. Here we enter our Ubuntu username and password and click “OK”
You are done,enjoy
附言:评论中提到了一些好的观点,所以我想总结一下。
如果你想从外部网络访问Ubuntu,你需要在工作中的Ubuntu拥有自己的合适的互联网IP地址-这是一个相当不太可能的情况。要使其正常工作,你需要工作地点的外部可见地址,并且在路由器上设置端口转发,将传入的RDP请求定向到你的工作计算机。(Mark Williams)
要使用Ubuntu MATE桌面的meta-session
,请将startwm.sh
中的最后一行startxfce4
替换为mate-session
。(Frank N)
您可以使用实际的机器名称(通过键入hostname
)而不是IP地址,因为在未来的会话中,动态IP地址可能更加稳定。(Frank N)
service xrdp start
的脚本。 - xinthosemate-session
会提供目标计算机当前登录的会话吗? - Superoleecho xfce4-session >~/.xsession
时,出现了以下错误:-bash: /home/longnx/.xsession: 没有那个文件或目录
https://imgur.com/a/AcCuAOv
我该怎么办?有什么关键词可以搜索以获得帮助? - Lukeecho xfce4-session > ~/.xsession
。如果不起作用,请使用 nano nano ~/.xsession
并将 echo xfce4-session
的内容复制到其中。 - Faizan Akram Darecho xfce4-session > ~/.xsession
此命令中的单个 >
符号意味着它将完全覆盖 ~/.xsession
文件。 - TheWanderersudo ufw allow 3389/tcp
- Kunal B.在Windows上实现X服务器的免费软件。
此方法需要最少的设置,并且非常可靠。
您必须首先在Ubuntu上安装SSH服务器,例如通过物理访问机器上的键盘:
sudo apt install openssh-server
sudo apt install x11-apps
xeyes
xeyes
以一个独立的本地 Windows 窗口打开。
一个令人讨厌的问题是,如果你在工作时打开了窗口,然后回到家,你必须启动一个新的应用实例,而且你看不到已经打开的窗口。这一点更加令人讨厌的是那些只能在单窗口模式下工作的应用程序,比如浏览器:你将不得不搜索如何强制启动一个新实例,然后你将有两个实例同时运行。
在 Windows 10 和 Ubuntu 19.10 上通过 MobaXterm v12.4 在本地网络上进行了测试:
这里是一张Windows截图,显示MobaXterm运行在左上角,并且两个程序(xeyes和firefox)在Ubuntu远程上运行,但显示为独立的本机Windows窗口!
MobaXterm X服务器的替代方案
我还没有尝试过这些,但行为应该类似于MobaXterm吧?希望我们能找到一个好的开源替代方案:
xrdp
提到于:https://askubuntu.com/a/592544/52975
我只想确认一下,在将Windows 10转换为Ubuntu 19.10时,并不需要像那个答案中提到的那样触碰一些配置文件,否则你只会得到一个黑屏:通过xrdp登录时出现空白桌面。https://www.chiark.greenend.org.uk/~sgtatham/putty/
如果你只想要一个通过SSH连接的文本终端,那么这是最佳解决方案。sudo apt install openssh-server
vscode和其他支持SSH的IDE
如果你是一名程序员,你已经知道这个,但我还是要说一下。
使用vscode,你可以仅通过SSH轻松设置远程vscode服务器,从而可以:
两者之间有完美的集成,例如在SSH终端路径上按Ctrl + 单击会在编辑器中打开所点击的文件。
从某种意义上说,这应该满足你所有非GUI应用程序访问的需求。