Merge pull request #24583 from geekpi/translating

translated
This commit is contained in:
geekpi 2022-02-08 08:44:24 +08:00 committed by GitHub
commit 47417974e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 235 additions and 236 deletions

View File

@ -1,236 +0,0 @@
[#]: subject: "Sharing the computer screen in Gnome"
[#]: via: "https://fedoramagazine.org/sharing-the-computer-screen-in-gnome/"
[#]: author: "Lukáš Růžička https://fedoramagazine.org/author/lruzicka/"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Sharing the computer screen in Gnome
======
![][1]
You do not want someone else to be able to monitor or even control your computer and you usually work hard to cut off any such attempts using various security mechanisms. However, sometimes a situation occurs when you desperately need a friend, or an expert, to help you with a computer problem, but they are not at the same location at the same time. How do you show them? Should you take your mobile phone, take pictures of your screen, and send it to them? Should you record a video? Certainly not. You can share your screen with them and possibly let them control your computer remotely for a while. In this article, I will describe how to allow sharing the computer screen in Gnome.
### Setting up the server to share its screen
A **server** is a computer that provides (serves) some content that other computers (clients) will consume. In this article the server runs **Fedora Workstation** with the standard **Gnome desktop**.
#### Switching on Gnome Screen Sharing
By default, the ability to share the computer screen in Gnome is **off**. In order to use it, you need to switch it on:
1. Start **Gnome Control Center**.
2. Click on the **Sharing** tab.
![Sharing switched off][2]
3. Switch on sharing with the slider in the upper right corner.
4. Click on **Screen sharing**.
![Sharing switched on][3]
5. Switch on screen sharing using the slider in the upper left corner of the window.
6. Check the _Allow connections to control the screen_ if you want to be able to control the screen from the client. Leaving this button unchecked will only allow _view-only_ access to the shared screen.
7. If you want to manually confirm all incoming connections, select _New connections must ask for access._
8. If you want to allow connections to people who know a password (you will not be notified), select _Require a password_ and fill in the password. The password can only be 8 characters long.
9. Check _Show password_ to see what the current password is. For a little more protection, do not use your login password here, but choose a different one.
10. If you have more networks available, you can choose on which one the screen will be accessible.
### Setting up the client to display a remote screen
A **client** is a computer that connects to a service (or content) provided by a server. This demo will also run **Fedora Workstation** on the client, but the operating system actually should not matter too much, if it runs a decent VNC client.
#### Check for visibility
Sharing the computer screen in Gnome between the server and the client requires a working network connection and a visible “route” between them. If you cannot make such a connection, you will not be able to view or control the shared screen of the server anyway and the whole process described here will not work.
To make sure a connection exists
Find out the IP address of the server.
Start **Gnome Control Center**, a.k.a **Settings**. Use the **Menu** in the upper right corner, or the **Activities** mode. When in **Activities**, type
settings
and click on the corresponding icon.
Select the **Network** tab.
Click on the **Settings button** (cogwheel) to display your network profiles parameters.
Open the **Details** tab to see the IP address of your computer.
Go to **your clients** terminal (the computer from which you want to connect) and find out if there is a connection between the client and the server using the **ping** command.
```
$ ping -c 5 192.168.122.225
```
Examine the commands output. If it is similar to the example below, the connection between the computers exists.
```
PING 192.168.122.225 (192.168.122.225) 56(84) bytes of data.
64 bytes from 192.168.122.225: icmp_seq=1 ttl=64 time=0.383 ms
64 bytes from 192.168.122.225: icmp_seq=2 ttl=64 time=0.357 ms
64 bytes from 192.168.122.225: icmp_seq=3 ttl=64 time=0.322 ms
64 bytes from 192.168.122.225: icmp_seq=4 ttl=64 time=0.371 ms
64 bytes from 192.168.122.225: icmp_seq=5 ttl=64 time=0.319 ms
--- 192.168.122.225 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4083ms
rtt min/avg/max/mdev = 0.319/0.350/0.383/0.025 ms
```
You will probably experience no problems if both computers live on the same subnet, such as in your home or at the office, but problems might occur, when your server does not have a **public IP address** and cannot be seen from the external Internet. Unless you are the only administrator of your Internet access point, you will probably need to consult about your situation with your administrator or with your ISP. Note, that exposing your computer to the external Internet is always a risky strategy and you **must pay enough attention** to protecting your computer from unwanted access.
#### Install the VNC client (Remmina)
**Remmina** is a graphical remote desktop client that can you can use to connect to a remote server using several protocols, such as VNC, Spice, or RDP. **Remmina** is available from the Fedora repositories, so you can installed it with both the **dnf** command or the **Software**, whichever you prefer. With dnf, the following command will install the package and several dependencies.
```
$ sudo dnf install remmina
```
#### Connect to the server
If there is a connection between the server and the client, make sure the following is true:
1. The computer is running.
2. The Gnome session is running.
3. The user with screen sharing enabled is logged in.
4. The session is **not locked**, i.e. the user can work with the session.
Then you can attempt to connect to the session from the client:
1. Start **Remmina**.
2. Select the **VNC** protocol in the dropdown menu on the left side of the address bar.
3. Type the IP address of the server into the address bar and hit **Enter**.
![Remmina Window][4]
4. When the connection starts, another connection window opens. Depending on the server settings, you may need to wait until the server user allows the connection, or you may have to provide the password.
5. Type in the password and press **OK**.
![Remmina Connected to Server][5]
6. Press ![Align with resolution button][6] ![][7] to resize the connection window to match the server resolution, or press ![Full Screen Button][8] ![][7] to resize the connection window over your entire desktop. When in fullscreen mode, notice the narrow white bar at the upper edge of the screen. That is the Remmina menu and you can access it by moving the mouse to it when you need to leave the fullscreen mode or change some of the settings.
When you return back to the server, you will notice that there is now a yellow icon in the upper bar which indicates that you are sharing the computer screen in Gnome. If you no longer wish to share the screen, you can enter the menu and click on **Screen is being shared** and then on select **Turn off** to stop sharing the screen immediately.
![Turn off menu item][9]
#### Terminating the screen sharing when session locks.
By default, the connection **will always terminate** when the session locks. A new connection cannot be established until the session is unlocked.
On one hand, this sounds logical. If you want to share your screen with someone, you might not want them to use your computer when you are not around. On the other hand, the same approach is not very useful, if you want to control your own computer from a remote location, be it your bed in another room or your mother-in-laws place. There are two options available to deal with this problem. You can either disable locking the screen entirely or you can use a Gnome extension that supports unlocking the session via the VNC connection.
##### Disable screen lock
In order to disable the screen lock:
1. Open the **Gnome Control Center**.
2. Click on the **Privacy** tab.
3. Select the **Screen Lock** settings.
4. Switch off **Automatic Screen Lock**.
Now, the session will never lock (unless you lock it manually), so it will be possible to start a VNC connection to it.
##### Use a Gnome extension to allow unlocking the session remotely.
If you do not want to switch off locking the screen or you want to have an option to unlock the session remotely even when it is locked, you will need to install an extension that provides this functionality as such behavior is not allowed by default.
To install the extension:
1. Open the **Firefox** browser and point it to [the Gnome extension page][10].
![][7]![Gnome Extensions Page][11]
2. In the upper part of the page, find an info block that tells you to install _GNOME Shell integration_ for Firefox.
3. Install the Firefox extension by clicking on _Click here to install browser extension_.
4. After the installation, notice the Gnome logo in the menu part of Firefox.
5. Click on the Gnome logo to navigate back to the extension page.
6. Search for _allow locked remote desktop_.
7. Click on the displayed item to go to the extensions page.
8. Switch the extension **ON** by using the **on/off** button on the right.
![Extension selected][12]
Now, it will be possible to start a VNC connection any time. Note, that you will need to know the session password to unlock the session. If your VNC password differs from the session password, your session is still protected _a little_.
### Conclusion
This article, described the way to enable sharing the computer screen in Gnome. It mentioned the difference between the limited (_view-only)_ access or not limited (_full)_ access. This solution, however, should in no case be considered a _correct approach_ to enable a remote access for serious tasks, such as administering a production server. Why?
1. The server will always keep its **control mode**. Anyone working with the server session will be able to control the mouse and keyboard.
2. If the session is locked, unlocking it from the client will also unlock it on the server. It will also wake up the display from the stand-by mode. Anybody who can see your server screen will be able to watch what you are doing at the moment.
3. The VNC protocol _per se_ is not encrypted or protected so anything you send over this can be compromised.
There are several ways, you can set up a protected VNC connection. You could tunnel it via the SSH protocol for better security, for example. However, these are beyond the scope of this article.
**Disclaimer**: The above workflow worked without problems on Fedora 35 using several virtual machines. If it does not work for you, then you might have hit a bug. Please, report it.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/sharing-the-computer-screen-in-gnome/
作者:[Lukáš Růžička][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/lruzicka/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2022/01/sharing_screen-816x345.jpg
[2]: https://fedoramagazine.org/wp-content/uploads/2022/01/settings_sharing_off.png
[3]: https://fedoramagazine.org/wp-content/uploads/2022/01/settings_sharing_on.png
[4]: https://fedoramagazine.org/wp-content/uploads/2022/01/remmina.png
[5]: https://fedoramagazine.org/wp-content/uploads/2022/01/remmina_connected_client.png
[6]: https://fedoramagazine.org/wp-content/uploads/2022/01/resolution.png
[7]: tmp.kscCxzbpG9
[8]: https://fedoramagazine.org/wp-content/uploads/2022/01/full_screen.png
[9]: https://fedoramagazine.org/wp-content/uploads/2022/01/turn_off_connection.png
[10]: https://extensions.gnome.org
[11]: https://fedoramagazine.org/wp-content/uploads/2022/01/extensions.png
[12]: https://fedoramagazine.org/wp-content/uploads/2022/01/switch_on_extension.png

View File

@ -0,0 +1,235 @@
[#]: subject: "Sharing the computer screen in Gnome"
[#]: via: "https://fedoramagazine.org/sharing-the-computer-screen-in-gnome/"
[#]: author: "Lukáš Růžička https://fedoramagazine.org/author/lruzicka/"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
在 Gnome 中共享电脑屏幕
======
![][1]
你不希望别人能够监视甚至控制你的电脑,你通常会努力使用各种安全机制来切断任何此类企图。然而,有时会出现这样的情况:你迫切需要一个朋友,或一个专家来帮助你解决电脑问题,但他们不在同一时间的同一地点。你如何向他们展示呢?你应该拿着你的手机,拍下你的屏幕照片,然后发给他们吗?你应该录制一个视频吗?当然不是。你可以与他们分享你的屏幕,并可能让他们远程控制你的电脑一段时间。在这篇文章中,我将介绍如何在 Gnome 中允许共享电脑屏幕。
### 设置服务器以共享屏幕
**服务器**是一台提供(服务)一些内容的计算机,其他计算机(客户端)将消费这些内容。在本文中,服务器运行的是 **Fedora Workstation** 和标准的 **Gnome 桌面**
#### 打开 Gnome 屏幕共享
默认情况下Gnome 中共享计算机屏幕的功能是**关闭**的。要使用它,你需要把它打开:
1. 启动 **Gnome 控制中心**
2. 点击**共享**标签。
![Sharing switched off][2]
3. 用右上角的滑块打开共享。
4. 单击**屏幕共享**。
![Sharing switched on][3]
5. 用窗口左上角的滑块打开屏幕共享。
6. 如果你希望能够从客户端控制屏幕请勾选_允许连接控制屏幕_。不勾选这个按钮访问共享屏幕只允许_仅浏览_。
7. 如果你想手动确认所有传入的连接请选择_新连接必须请求访问_。
8. 如果你想允许知道密码的人连接你不会被通知选择_需要密码_并填写密码。密码的长度只能是 8 个字符。
9. 勾选_显示密码_以查看当前的密码是什么。为了多一点保护不要在这里使用你的登录密码而是选择一个不同的密码。
10. 如果你有多个网络可用,你可以选择在哪个网络上访问该屏幕。
### 设置客户端以显示远程屏幕
**客户端**是一台连接到由服务器提供的服务(或内容)的计算机。本演示还将在客户端上运行 **Fedora Workstation**,但如果它运行一个 VNC 客户端,操作系统实际上应该不太重要。
#### 检查可见性
在 Gnome 中,服务器和客户端之间共享计算机屏幕需要一个有效的网络连接,以及它们之间可见的“路由”。如果你不能建立这样的连接,你将无法查看或控制服务器的共享屏幕,这里描述的整个过程将无法工作。
为了确保连接的存在,找出服务器的 IP 地址。
Start **Gnome Control Center**, a.k.a **Settings**. Use the **Menu** in the upper right corner, or the **Activities** mode. When in **Activities**, type
启动 **Gnome 控制中心**,又称**设置**。使用右上角的**菜单**,或**活动**模式。当在**活动**中时,输入:
settings
并点击相应的图标。
选择**网络**标签。
点击**设置按钮**(齿轮)以显示你的网络配置文件的参数。
打开**详情**标签,查看你的计算机的 IP 地址。
Go to **your clients** terminal (the computer from which you want to connect) and find out if there is a connection between the client and the server using the **ping** command.
进入**你的客户端的**终端(你想连接的计算机),使用 **ping** 命令找出客户和服务器之间是否有连接。
```
$ ping -c 5 192.168.122.225
```
检查该命令的输出。如果它与下面的例子相似,说明计算机之间的连接存在。
```
PING 192.168.122.225 (192.168.122.225) 56(84) bytes of data.
64 bytes from 192.168.122.225: icmp_seq=1 ttl=64 time=0.383 ms
64 bytes from 192.168.122.225: icmp_seq=2 ttl=64 time=0.357 ms
64 bytes from 192.168.122.225: icmp_seq=3 ttl=64 time=0.322 ms
64 bytes from 192.168.122.225: icmp_seq=4 ttl=64 time=0.371 ms
64 bytes from 192.168.122.225: icmp_seq=5 ttl=64 time=0.319 ms
--- 192.168.122.225 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4083ms
rtt min/avg/max/mdev = 0.319/0.350/0.383/0.025 ms
```
如果两台计算机生活在同一个子网中,例如在你的家里或办公室,你可能不会遇到任何问题,但当你的服务器没有**公共IP地址**,无法从外部互联网上看到时,可能会出现问题。除非你是互联网接入点的唯一管理员,否则你可能需要就你的情况向你的管理员或你的 ISP 咨询。请注意,将你的计算机暴露在外部互联网上始终是一个有风险的策略,你**必须充分注意**保护你的计算机免受不必要的访问。
#### 安装 VNC 客户端Remmina
**Remmina** 是一个图形化的远程桌面客户端,你可以使用多种协议连接到远程服务器,如 VNC、Spice 或 RDP。**Remmina** 可以从 Fedora 仓库中获得,所以你可以用 **dnf** 命令或**软件中心**来安装它,以你喜欢的方式为准。使用 dnf下面的命令将安装该软件包和几个依赖项。
```
$ sudo dnf install remmina
```
#### 连接到服务器
如果服务器和客户端之间有连接,请确保以下情况为没错:
1. 计算机正在运行。
2. Gnome 会话正在运行。
3. 启用了屏幕共享的用户已经登录。
4. 会话**没有被锁定**,也就是说,用户可以使用会话。
然后你可以尝试从客户端连接到该会话:
1. 启动 **Remmina**.
2. 在地址栏左侧的下拉菜单中选择 **VNC** 协议。
3. 在地址栏中输入服务器的IP地址然后按下**回车**。
![Remmina Window][4]
4. 当连接开始时,会打开另一个连接窗口。根据服务器的设置,你可能需要等待,直到服务器用户允许连接,或者你可能需要提供密码。
5. 输入密码,然后按 **OK**
![Remmina Connected to Server][5]
6. 按下 ![Align with resolution button][6] 调整连接窗口的大小,使之与服务器的分辨率一致,或者按 ![Full Screen Button][8] 调整连接窗口的大小,使其覆盖整个桌面。当处于全屏模式时,注意屏幕上边缘的白色窄条。那是 Remmina 菜单,当你需要离开全屏模式或改变一些设置时,你可以把鼠标移到它上面。
当你回到服务器时,你会注意到现在在上栏有一个黄色的图标,这表明你正在 Gnome 中共享电脑屏幕。如果你不再希望共享屏幕,你可以进入菜单,点击**屏幕正在被共享**,然后在选择**关闭**,立即停止共享屏幕。
![Turn off menu item][9]
#### 会话锁定时终止屏幕共享
默认情况下,当会话锁定时,连接**将始终终止**。在会话被解锁之前,不能建立新的连接。
一方面,这听起来很合理。如果你想和别人分享你的屏幕,你可能不想让他们在你不在的时候使用你的电脑。另一方面,如果你想从远程位置控制你自己的电脑,无论是你在另一个房间的床上,还是你岳母的地方,同样的方法也不是很有用。有两个选项可以处理这个问题。你可以完全禁止锁定屏幕,或者使用支持通过 VNC 连接解锁会话的 Gnome 扩展。
##### 禁用屏幕锁
要禁用屏幕锁:
1. 打开 **Gnome 控制中心**
2. 点击**隐私**标签。
3. 选择**屏幕锁定**设置。
4. 关掉**自动屏幕锁定**。
现在,会话将永远不会被锁定(除非你手动锁定),所以它将有可能启动一个 VNC 连接到它。
##### 使用 Gnome 扩展来允许远程解锁会话
如果你不想关闭锁定屏幕的功能,或者你想有一个远程解锁会话的选项,即使它被锁定,你将需要安装一个提供这种功能的扩展,因为这种行为是默认不允许的。
要安装该扩展:
1. 打开**火狐浏览器**,并打开 [Gnome 扩展页面][10]。
![][7]![Gnome Extensions Page][11]
2. 在页面的上部,找到一个信息块,告诉你为火狐安装 _GNOME Shell integration_
3. 点击 _Click here to install browser extension_ 来安装 Firefox 扩展。
4. 安装完毕后,注意到 Firefox 的菜单部分有 Gnome 的标志。
5. 点击 Gnome 标志,回到扩展页面。
6. 搜索 _allow locked remote desktop_
7. 点击显示的项目,进入该扩展的页面。
8. 使用右边的**开/关**按钮,将扩展**打开**
![Extension selected][12]
现在,可以在任何时候启动 VNC 连接。注意,你需要知道会话密码以解锁会话。如果你的 VNC 密码与会话密码不同你的会话仍然受到_一点_保护。
### 总结
这篇文章介绍了在 Gnome 中实现共享计算机屏幕的方法。它提到了受限_仅浏览_访问和非受限_完全_访问之间的区别。然而这个解决方案在任何情况下都不应该被认为是一个正确的方法以实现对严肃任务的远程访问例如管理一个生产服务器。为什么
1. 服务器将始终保持其**控制模式**。任何在服务器会话中的人都将能够控制鼠标和键盘。
2. 如果会话被锁定,从客户端解锁也会在服务器上解锁。它也会把显示器从待机模式中唤醒。任何能看到你的服务器屏幕的人都能看到你此刻正在做什么。
3. VNC 协议本身没有加密或保护,所以你通过它发送的任何东西都可能被泄露。
你几种可以建立一个受保护的 VNC 连接的方法。例如,你可以通过 SSH 协议建立隧道,以提高安全性。然而,这些都超出了本文的范围。
**免责声明**:上述工作流程在 Fedora 35 上使用几个虚拟机工作时没有问题。如果它对你不起作用,那么你可能遇到了一个错误。请报告它。
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/sharing-the-computer-screen-in-gnome/
作者:[Lukáš Růžička][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/lruzicka/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2022/01/sharing_screen-816x345.jpg
[2]: https://fedoramagazine.org/wp-content/uploads/2022/01/settings_sharing_off.png
[3]: https://fedoramagazine.org/wp-content/uploads/2022/01/settings_sharing_on.png
[4]: https://fedoramagazine.org/wp-content/uploads/2022/01/remmina.png
[5]: https://fedoramagazine.org/wp-content/uploads/2022/01/remmina_connected_client.png
[6]: https://fedoramagazine.org/wp-content/uploads/2022/01/resolution.png
[8]: https://fedoramagazine.org/wp-content/uploads/2022/01/full_screen.png
[9]: https://fedoramagazine.org/wp-content/uploads/2022/01/turn_off_connection.png
[10]: https://extensions.gnome.org
[11]: https://fedoramagazine.org/wp-content/uploads/2022/01/extensions.png
[12]: https://fedoramagazine.org/wp-content/uploads/2022/01/switch_on_extension.png