博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
远程ubuntu桌面_如何在Ubuntu上设置远程桌面
阅读量:2505 次
发布时间:2019-05-11

本文共 17210 字,大约阅读时间需要 57 分钟。

远程ubuntu桌面

远程ubuntu桌面

Ubuntu mug next to a laptop, phone, and Rubik's Cube.

Need to get your hands on a distant Ubuntu Linux computer? Set up Ubuntu’s Screen Sharing and take remote control when you need to. You can connect to Screen Sharing with any VNC client. We’ll show you how.

是否需要使用一台遥远的Ubuntu Linux计算机? 设置Ubuntu的屏幕共享,并在需要时进行远程控制。 您可以使用任何VNC客户端连接到“屏幕共享”。 我们将向您展示如何。

Ubuntu的内置“屏幕共享”是VNC服务器 (Ubuntu’s Built-In “Screen Sharing” Is a VNC Server)

When you make to a remote Ubuntu Linux computer, you get a terminal window interface. That’s perfectly fine for many tasks, such as system administration, and it has the advantage of being a lightweight connection. There are no graphics to transmit from the host computer to the local client, so it’s fast and easy to set up.

当您与远程Ubuntu Linux计算机 ,您将获得一个终端窗口界面。 对于许多任务(例如系统管理)而言,这是完全可以的,并且它具有轻量级连接的优点。 没有图形可以从主机传输到本地客户端,因此设置起来既快速又容易。

If you want to see graphical applications installed on the remote host on your local computer, you can do that with , which is also easy to set up.

如果要查看本地计算机上远程主机上安装的图形应用程序,可以 ,该也很容易设置。

But what if you want to go all-in and see the entire remote desktop and it as though you were sitting right in front of it? Simple—you use “screen sharing,” also known as desktop sharing.

但是,如果您想全神贯注地查看整个远程桌面,并且好像您正坐在桌面前一样呢? 简单-您使用“屏幕共享”,也称为桌面共享。

To do this, you configure screen sharing on the remote computer and connect to it with on the local computer. And—you’ve guessed it—it’s easy to set up.

为此,您可以在远程计算机上配置屏幕共享,并通过本地计算机上的连接到它。 而且-您已经猜到了-易于设置。

Although this article concentrates on Ubuntu, this is really a GNOME thing. It works equally well on any other Linux that has a GNOME version of their distribution. Manjaro and Fedora, for example, have the same options and settings described below. We went through this process with Ubuntu 18.04 LTS.

尽管本文着重于Ubuntu,但这确实是GNOME的事情。 它在具有GNOME版本的其他任何Linux上也能很好地工作。 例如,Manjaro和Fedora具有以下相同的选项和设置。 我们使用Ubuntu 18.04 LTS进行了此过程。

如何在远程主机上启用屏幕共享 (How to Enable Screen Sharing on the Remote Host)

These are the settings you make on the remote Ubuntu computer you’re going to connect to.

这些是您要连接到的远程Ubuntu计算机上的设置。

On the system menu, click the Settings icon.

在系统菜单上,单击“设置”图标。

Click the settings icon on the system menu.

In the “Settings” dialog, click “Sharing” in the side panel, and then click the “Sharing” toggle On.

在“设置”对话框中,单击侧面板中的“共享”,然后单击“共享”切换为开。

Click "Sharing" in the side panel, and then click the Sharing toggle On.

Click “Off” next to the “Screen Sharing” option, so it changes to “On.”

单击“屏幕共享”选项旁边的“关闭”,将其更改为“打开”。

Click On the "Screen Sharing" option.

The “Screen Sharing” dialog appears. Click the toggle in the title bar to turn it On.

出现“屏幕共享”对话框。 单击标题栏中的切换开关将其打开。

Click the toggle in the title bar of the "Screen Sharing" dialog to turn it On.

When the toggle is turned on, the slider at the bottom of the dialog also changes to On.

当切换开关打开时,对话框底部的滑块也会变为“打开”。

By default, “Access Options” is set to “New Connections Must Ask for Access.” This means every user has to confirm each connection. If you’re trying to connect remotely, this won’t work, so configure a password instead. Select the “Require a Password” radio button and type a password in the “Password” field.

默认情况下,“访问选项”设置为“新连接必须要求访问”。 这意味着每个用户都必须确认每个连接。 如果您尝试远程连接,则此操作将无效,因此请配置密码。 选择“需要密码”单选按钮,然后在“密码”字段中输入密码。

This password is not related to any user account, but it must be provided by remote clients when they connect. It’s limited to eight characters, so make it as complex as possible. If you forget the password, you can always repeat these steps to reset it.

该密码与任何用户帐户都不相关,但是必须由远程客户端在连接时提供。 它限制为八个字符,因此请使其尽可能复杂。 如果忘记了密码,则始终可以重复这些步骤来重置密码。

Select "Require a Password" and type a password in the "Password" field.

After you’ve typed a password, close the “Screen Sharing” and “Settings” dialogs.

输入密码后,关闭“屏幕共享”和“设置”对话框。

Encryption is used to transfer and verify the password when a connection request is made. Whether the rest of the VNC traffic is encrypted depends on the . This is more of a concern on connections across the internet.

发出连接请求时,加密用于传输和验证密码。 是否对其余的VNC通信进行加密取决于的 。 这是跨Internet连接的一个更重要的问题。

Unless you have a secure VPN between your two sites or the VNC connection is otherwise protected (by being tunneled through SSH, for example), it’s safe to assume the connection is not encrypted. Avoid opening sensitive or private documents over the connection.

除非您在两个站点之间拥有安全的VPN或通过其他方式保护VNC连接(例如通过通过SSH隧道传输),否则可以安全地假定连接未加密。 避免通过连接打开敏感或私人文档。

Now, we need to configure a client to connect to this computer, and that brings us to IP addresses.

现在,我们需要配置一个客户端以连接到这台计算机,这将我们带到IP地址。

如何通过Internet访问远程系统 (How to Access the Remote System Over the Internet)

Warning: We recommend using VNC only over a local network. Ubuntu’s Screen Sharing won’t let you set a password longer than eight characters. If you want to connect remotely, we recommend setting up a server on the network with the remote Ubuntu system. Connect to the VPN from the internet, and then connect to the VNC system through the VPN. This avoids exposing the VNC server directly to the network. However, if you want to make the Screen Sharing server accessible over the internet anyway, this section shows you how.

警告 :我们建议仅在本地网络上使用VNC。 Ubuntu的“屏幕共享”不允许您设置超过八个字符的密码。 如果要远程连接,建议您在具有远程Ubuntu系统的网络上设置服务器。 从Internet连接到VPN,然后通过VPN连接到VNC系统。 这样可以避免将VNC服务器直接暴露给网络。 但是,如果您想使Screen Sharing服务器仍然可以通过Internet访问,本节将向您展示如何。

If you’re not on the same network as the remote Ubuntu computer, you’re going to need to connect to it over the internet. The IP address a network presents to the internet is its public IP address. It’s actually the IP address of the router, which is assigned by the (ISP). So, we need to find that IP address.

如果您与远程Ubuntu计算机不在同一网络上,则需要通过Internet连接到它。 网络提供给互联网的IP地址是其公共IP地址。 它实际上是路由器的IP地址,由 (ISP)分配。 因此,我们需要找到该IP地址。

The easiest way to do this is type “my ip” into the Google search bar on the remote Ubuntu computer and then press Enter.

最简单的方法是在远程 Ubuntu计算机上的Google搜索栏中输入“ my ip”,然后按Enter。

Google search results for "my ip."

This is good to know, but it’s not enough to make a connection to the remote computer.

知道这一点很高兴,但这还不足以与远程计算机建立连接。

Imagine you want to call someone at a hotel. You can’t call their room directly. You first call the hotel and give them the name of the guest you want to speak to. The switchboard operator checks the hotel directory and puts your call through to the correct room.

假设您想在酒店给某人打电话。 您不能直接给他们的房间打电话。 您首先打电话给酒店,并给他们您要交谈的客人的名字。 总机接线员检查酒店目录,然后将您的呼叫转到正确的房间。

The router on a network acts as the switchboard operator. So, the router on the remote network must be configured to forward VNC connection requests to the Ubuntu PC. This is a networking technique called .

网络上的路由器充当总机操作员。 因此,必须将远程网络上的路由器配置为将VNC连接请求转发到Ubuntu PC。 这是一种称为的网络技术。

But let’s back up a moment. Your ISP might have assigned you either a static public IP address or a dynamic public IP address. A static public IP is permanent, while a dynamic public IP address likely changes when your router reboots. If your public IP address changes periodically, remote computers won’t know to which IP address to send their connection request.

但是,让我们备份一下。 您的ISP可能已为您分配了静态公共IP地址或动态公共IP地址。 静态公共IP是永久性的,而动态公共IP地址可能会在路由器重新引导时发生变化。 如果您的公共IP地址定期更改,则远程计算机将不知道向其发送连接请求的IP地址。

The solution is something called (DDNS). There are free DDNS providers you can use. The general process is:

解决方案是所谓的 (DDNS)。 您可以使用免费的DDNS提供程序。 一般过程是:

  • You register with the DDNS provider and receive a static web address.

    您向DDNS提供商注册并收到一个静态网址。
  • You configure your router to periodically contact your DDNS provider and inform it of its current IP address.

    您将路由器配置为定期与DDNS提供商联系,并通知其当前IP地址。
  • The DDNS system updates its record of your web address, so it points to your IP address. This means connection requests made to your web address are always forwarded to your current—and correct—IP address.

    DDNS系统会更新您的网址记录,因此它指向您的IP地址。 这意味着对您的网址的连接请求将始终转发到您当前的正确IP地址。

Using our hotel analogy, the connection request thus far has made it to the hotel switchboard. To complete the connection, the router must perform the port forwarding.

使用我们的酒店类比,到目前为止,连接请求已到达酒店总机。 要完成连接,路由器必须执行端口转发。

Routers can send traffic that arrives on a specific port to a specific computer. Once they’ve been configured to send VNC traffic to a particular computer, all incoming VNC connection requests are directed to that computer.

路由器可以将到达特定端口的流量发送到特定计算机。 将它们配置为向特定计算机发送VNC通信后,所有传入的VNC连接请求都将定向到该计算机。

If you’re going to use VNC across the internet, it’s advisable to use a nonstandard port. By default, the remote Ubuntu computer listens for VNC connection requests on TCP/IP port 5900.

如果要在互联网上使用VNC,建议使用非标准端口。 默认情况下,远程Ubuntu计算机在TCP / IP端口5900上侦听VNC连接请求。

This is a well-defined convention, but we verified it anyway by analyzing some network traffic:

这是一个定义明确的约定,但是我们还是通过分析一些网络流量来对此进行了验证:

Network trace showing "Destination Port: 5900."

We can mask that detail from the outside world by using a nonstandard port, like 43025. The remote router must then be configured to forward connection requests for port 43025—or whichever port you choose—to the Ubuntu computer on port 5900.

我们可以通过使用非标准端口(例如43025)来屏蔽外界的细节。然后,必须将远程路由器配置为将端口43025(或您选择的任意端口)的连接请求转发到端口5900上的Ubuntu计算机。

That’s like ringing the hotel and asking to speak to the geek in room 43025. The operator knows the geek is really in room 5900 and connects your call. The geek doesn’t know what room you asked for and he doesn’t care. You don’t know what room the geek is really in, nor do you care.

这就像给酒店打电话并要求与房间43025中的极客通话一样。接线员知道该极客确实在5900房间中并接通了您的电话。 怪胎不知道你要什么房间,他不在乎。 您不知道极客真正位于哪个房间,也不在乎。

The conversation between you can proceed, and that was the desired outcome.

你们之间的对话可以继续,那是理想的结果。

如何从Linux系统连接 (How to Connect From a Linux System)

The client computer that’s going to connect to our Ubuntu computer doesn’t have to be running Ubuntu. As we’ll see when we configure a Windows client, it doesn’t even have to be running Linux.

将要连接到我们的Ubuntu计算机的客户端计算机不必运行Ubuntu。 正如我们将在配置Windows客户端时看到的那样,它甚至不必运行Linux。

To reinforce the distribution-agnostic nature of the connection, we’re going to connect from a computer running Manjaro. The steps are the same for other distributions.

为了加强连接的与分布无关的性质,我们将通过运行Manjaro的计算机进行连接。 其他发行版的步骤相同。

We’re going to make a Virtual Computing Network (VNC) connection, so we need to use a client capable of that. Remmina is a remote desktop client that supports VNC, and it’s bundled with many Linux distributions, including Ubuntu. It’s easy to install (if it’s not already) from the package manager of other distributions.

我们将建立虚拟计算网络(VNC)连接,因此我们需要使用具有此功能的客户端。 Remmina是支持VNC的远程桌面客户端,它与许多Linux发行版(包括Ubuntu)捆绑在一起。 很容易从其他发行版的程序包管理器中安装(如果尚未安装)。

Press the Super key, located between the left-hand Ctrl and Alt keys, and then type the first few letters of “remmina.” The Remmina icon will appear at the top of the screen.

按位于左侧Ctrl和Alt键之间的Super键,然后键入“ remmina”的前几个字母。 Remmina图标将出现在屏幕顶部。

Click the icon to launch Remmina.

单击该图标以启动Remmina。

The Remmina icon.

When the Remmina dialog appears, click the “+” sign to create a new connection.

当出现Remmina对话框时,单击“ +”号以创建新的连接。

Click the "+" sign in the Remmina main window.

The Remote Desktop Preference dialog appears. This is where you input details about the connection to the remote computer. These can be saved and reused, so you don’t have to retype them each time you want to connect.

出现“远程桌面首选项”对话框。 在此处输入有关到远程计算机的连接的详细信息。 它们可以保存并重复使用,因此您不必每次都要连接时都重新输入它们。

The "Remote Desktop Preference" dialog.

Provide a “Name” for this connection. You can choose anything, but it should be something that identifies the computer to which you’ll be connecting.

为此连接提供一个“名称”。 您可以选择任何东西,但应该可以识别您要连接的计算机。

You can leave the “Group” field blank or provide a name for the group. If you configure many connections, they can be grouped into categories, such as Linux Computers, Windows Computers, Head Office, Local Branches, and so on.

您可以将“组”字段保留为空白或为组提供名称。 如果配置了许多连接,则可以将它们分为几类,例如Linux计算机,Windows计算机,总部,本地分支等。

Select “VNC – VNC Viewer” from the “Protocol” drop-down menu. More fields appear now that Remmina knows which protocol we want to use.

从“协议”下拉菜单中选择“ VNC – VNC查看器”。 现在,Remmina知道我们要使用哪种协议,因此会出现更多字段。

"Remote Desktop Preference" dialog with values in the fields.

In the “Server” field, enter either the IP address or network name of the remote computer. The “User Name” field is not related to a Linux user account; you can type anything here. The “Password” must be the password you used when you set up screen sharing on the remote Ubuntu machine.

在“服务器”字段中,输入远程计算机的IP地址或网络名称。 “用户名”字段与Linux用户帐户无关; 您可以在此处输入任何内容。 “密码”必须是在远程Ubuntu计算机上设置屏幕共享时使用的密码。

Select a value from the “Colour Depth” drop-down menu. Lower values are more responsive, but the screen will look flat and slightly psychedelic. If the visuals aren’t important to you, and you favor speed over prettiness, choose a low value. Higher values look more like the actual desktop. On slow connections, however, they can be sluggish to update, and mouse movements can be erratic.

从“颜色深度”下拉菜单中选择一个值。 较低的值响应速度更快,但屏幕看起来平坦且略带迷幻色彩。 如果视觉效果对您而言并不重要,并且您更喜欢速度而不是美感,请选择一个较低的值。 更高的值看起来更像实际的桌面。 但是,如果连接速度较慢,它们的更新速度可能会变慢,并且鼠标的移动可能会不稳定。

Select “Medium” from the “Quality” drop-down menu. If everything seems fine when you’re connected, you can adjust this to a higher value for subsequent connections. But to make sure the connection works, “Medium” is a good starting point.

从“质量”下拉菜单中选择“中等”。 如果连接时一切正常,则可以为后续连接将其调整为更高的值。 但是要确保连接正常,“中”是一个很好的起点。

After you configure your connection details, click the “Save” button. You return to the main Remmina window, and your new connection is listed there.

配置连接详细信息后,单击“保存”按钮。 您返回到Remmina主窗口,并在其中列出新的连接。

The new connection listed in the main Remmina window.

Double-click the connection to connect to the remote Ubuntu computer. The remote computer must be powered on, and the person who set up screen sharing must be logged in. He’ll see a notification that you’re connected and controlling his desktop, which is only polite.

双击连接以连接到远程Ubuntu计算机。 必须打开远程计算机的电源,并且必须设置屏幕共享的人员登录。他会看到一条通知,通知您已连接并控制他的桌面,这只是礼貌。

Remote connection notifying remote user that another user is controlling his desktop.

It’s important to note you’re not logging in to the remote computer—you’re taking over the session of the person who is already logged in.

重要的是要注意您没有登录到远程计算机,而是要接管已经登录的人的会话。

Remmina shows you the remote desktop in a window on your computer. You can move the mouse and use the keyboard the same as if you were sitting at the remote computer.

Remmina在计算机的一个窗口中向您显示远程桌面。 您可以像坐在远程计算机上一样移动鼠标并使用键盘。

The icons on the side panel allow you to maximize the window, scale the remote desktop to the Remmina window, go to full-screen view, and so on. Hover your mouse over the icons to get a tool-tip to see what they do.

侧面板上的图标使您可以最大化窗口,将远程桌面缩放到Remmina窗口,进入全屏视图等等。 将鼠标悬停在图标上可获得工具提示,以查看其功能。

Remote Ubuntu desktop in a Remmina VNC session.

When you’ve finished with your remote connection, disconnect from the remote computer by clicking the bottom icon in the side panel.

完成远程连接后,请单击侧面板上的底部图标,断开与远程计算机的连接。

Click the bottom "disconnect" icon in the side panel to end your remote session.

如何从Windows系统连接 (How to Connect From a Windows System)

Windows has compatibility problems with the encryption used in the VNC connection, so we’ll make the use of encryption optional. This way, computers that use the encryption can do so, and those that don’t can connect without it.

Windows在VNC连接中使用的加密存在兼容性问题,因此我们将加密的使用设为可选。 这样,使用加密的计算机可以这样做,而没有加密的计算机则无法连接。

Warning: Anyone on your network will be able to eavesdrop on the connection. This is another reason why it’s good to use this on a local network or via a VPN—not over the internet!

警告 :您网络上的任何人都可以窃听连接。 这是在本地网络或通过VPN(而不是通过Internet)使用它的好原因的另一个原因!

Use this command on the remote Ubuntu computer to make encryption optional:

在远程Ubuntu计算机上使用此命令可将加密设置为可选:

gsettings set org.gnome.Vino require-encryption false
"gsettings set org.gnome.Vino require-encryption false" in a terminal window.

If you don’t have RealVNC on your Windows computer, . The installation is simple—just click the “Next” buttons and accept the defaults.

如果您的Windows计算机上没有RealVNC,请 。 安装很简单-只需单击“下一步”按钮并接受默认设置即可。

After it’s installed, launch the “VNC Viewer” application from the Start menu. Select “New Connection” from the “File” menu.

安装后,从开始菜单启动“ VNC Viewer”应用程序。 从“文件”菜单中选择“新建连接”。

Click "File" and select "New Connection."

The “Properties” dialog appears. Type the IP address or network name of the remote Ubuntu server in the “VNC Server” field.

出现“属性”对话框。 在“ VNC服务器”字段中输入远程Ubuntu服务器的IP地址或网络名称。

In the “Name” field, type a name for this connection, so you recognize which remote computer it connects to. You can provide a label in the “Label” field or leave it blank.

在“名称”字段中,为此连接键入一个名称,以便您识别其连接到的远程计算机。 您可以在“标签”字段中提供标签,也可以将其留空。

In the “Security” group, leave the “Encryption” drop-down menu set to “Let VNC Server Choose.” Ensure that both the “Authenticate using single sign-on (SSO) if possible” and the “Authenticate using a smartcard or certificate store if possible” options are unchecked.

在“安全”组中,将“加密”下拉菜单设置为“让VNC服务器选择”。 确保未选中 “如果可能,使用单点登录(SSO)进行身份验证”和“如果可能,使用智能卡或证书存储区进行身份验证”选项。

Make sure "Authenticate using single sign-on (SSO) if possible" and "Authenticate using a smartcard or certificate store if possible" are unchecked.

Click “OK” to save your settings. An icon for your new connection appears in the main window.

单击“确定”保存设置。 新连接的图标出现在主窗口中。

A new connection icon in the main RealNVC window.

Double-click the icon to connect to the remote computer. You’ll see a splash screen as the connection is initiated.

双击图标以连接到远程计算机。 启动连接后,您会看到一个初始屏幕。

Splash screen in RealVNC as a connection is initiated.

Because you made encryption optional, and it won’t be used from the Windows computer, you see a warning dialog.

因为您将加密设置为可选,并且Windows计算机不会使用它,所以您会看到一个警告对话框。

Select the “Don’t warn me about this again on this computer” checkbox, and then click “Continue.”

选中“不要在此计算机上再次警告我”复选框,然后单击“继续”。

Select the "Don't warn me about this again on this computer" checkbox.

You see the desktop of the remote Ubuntu computer in the RealVNC window.

您会在RealVNC窗口中看到远程Ubuntu计算机的桌面。

Remote Ubuntu desktop in a RealVNC window.

Remember, the Windows VNC connection is not encrypted, so don’t open private documents or emails using this connection.

请记住,Windows VNC连接未加密,因此请勿使用此连接打开私人文档或电子邮件。

永远不会太远 (Never Too Far Away)

If you need to access an Ubuntu computer remotely, you now have an easy way to do so. As a bonus feature, RealVNC also has a free app for  smartphones and . You can set it up by following the same steps above.

如果您需要远程访问Ubuntu计算机,则现在可以轻松实现。 作为一项额外功能,RealVNC还为智能手机和提供了免费应用程序。 您可以按照上述相同步骤进行设置。

realVNC on an Android phone, connected to a remote Ubuntu computer.

翻译自:

远程ubuntu桌面

转载地址:http://dczwd.baihongyu.com/

你可能感兴趣的文章
MySQL 5.1参考手册
查看>>
TensorFlow安装流程(GPU加速)
查看>>
OpenStack的容器服务体验
查看>>
【BZOJ 4059】 (分治暴力|扫描线+线段树)
查看>>
BZOJ 1066 蜥蜴(网络流)
查看>>
提高批量插入数据的方法
查看>>
Linux重启Mysql命令
查看>>
前端模块化:RequireJS(转)
查看>>
linux 内核的优化
查看>>
近端梯度算法(Proximal Gradient Descent)
查看>>
DRM-内容数据版权加密保护技术学习(中):License预发放实现 (转)
查看>>
TCP与UDP协议
查看>>
php上传文件如何保证上传文件不被改变或者乱码
查看>>
目录遍历代码
查看>>
iOS MD5加密实现方法
查看>>
cygwin下的目录软连接
查看>>
eclipse控制台不显示输出的解决办法
查看>>
Java中的TCP/UDP网络通信编程
查看>>
Mysql支持的数据类型(总结)
查看>>
对测试转开发的一些想法
查看>>