Sharing the computer screen in Gnome

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
  3. Switch on sharing with the slider in the upper right corner.
  4. Click on Screen sharing.

    Sharing switched on
  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 profile’s parameters.

Open the Details tab to see the IP address of your computer.

Go to your client’s 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 command’s 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. 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
  6. Press Align with resolution button to resize the connection window to match the server resolution, or press Full Screen Button 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

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-law’s 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.

    Gnome Extensions Page
  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 extension’s page.
  8. Switch the extension ON by using the on/off button on the right.

    Extension selected

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.

Fedora Project community Using Software

22 Comments

  1. Ed

    Is there a way to use RDP protocol instead of VNC?

  2. Craig Mouldey

    I have no idea what the Gnome control center is.

    • Eric Phetteplace

      Super/Windows key, then type Gnome Control Center, that brings you to Settings. Same thing, different name.

    • Yeah, whenever I have used Settings, people told me that the correct name was Gnome Control Center.

  3. Benjamin

    Since this article focus on Gnome, why not using Connections [1] for the client application? AFAIK, it comes preinstalled on Fedora Workstation edition. Is there any reason you didn’t mention it in the article? Didn’t work as good as Remmina?

    [1] https://apps.gnome.org/app/org.gnome.Connections/

    • You can use Connections, if you like. I just tried and it works similarly. I just did not know such application was installed by default. Thanks for letting us know.

  4. FirstLast

    I was stuck in Step 5 “Switch on screen sharing using the slider in the upper left corner of the window.” It wouldn’t let me switch on that button. How should I proceed? Thank you.

    • Sorry, there are actually two sliders that switch on the Sharing. The first one is in in the upper right corner when you choose the Sharing tab from Settings. If you do not switch this on, you will not be able to set up Sharing at all. Once you allow this with the slider, you can click “Screen Sharing”, then there comes another smaller window with another slider in the upper left corner, you allow this too. Since now, screen sharing is allowed for your session. On that window, you also set the parameters of how the screen will be shared.

      I hope this clarifies it for you.

      • LW

        Thanks for your reply. But I have already switched on the first slider, as described in step 3, and it’s the second slider that wouldn’t switch on.
        I recently installed Fedora 35 Gnome on a Lenovo laptop, which was running Windows 10 before. Screen sharing is very important for me, and I have tried a few applications but nothing worked. I wonder if it’s because of the screen sharing slider that I was unable to switch on. Any additional advice would be appreciated. Thanks.

        • Have you installed “Fedora Workstation” from the Live media or have you used some other installation method, such as netinst?
          Have you freshly installed the system or have you just upgraded a previous version?
          Have you fully updated the system?
          Which applications did you try to run that did not work?

          From the top of my head, I am not aware of anything why it should not work the described way. I tested this routine several times on Fedora 35 and it always worked. You might have hit a bug, maybe.

  5. Darvond

    So any other DE/WM?

  6. Tony W

    This is essentially what I have been looking to do for a while now. I tested this from one Fedora Desktop to a Fedora VM that is running from a KVM on another Fedora Desktop. Both are running on F34. Thank you!

  7. Haenzel

    I find NoMachine (server and client) a good solution…

    • This might be an option, sure. The article, however, focuses on one of the ways to achieve this using default apps on a Fedora Workstation, or apps that can be installed from the default Fedora repositories. NoMachine does not fit into this scenario.

  8. Joe

    That gnome extension to unlock is very handy. If you don’t have that, or don’t want it, another way to unlock remotely is ssh login first, and use “loginctl unlock-sessions” and type password. Then you can VNC in. another hint I’ve found is certain apps have an issue with the encryption for some reason. I only use screen sharing remotely so don’t mind disabling it. You can use dconf editor to go to org.gnome.desktop.remote-desktop and set encryption to none for vnc. this solve the issue for me.

    • Joe

      Oops, regarding disabling encryption, I meant to say I only use at home on local network, so not remotely. Wrong word there. Opposite of “remotely.”

    • vdb

      …way to unlock remotely is ssh login first, and use “loginctl unlock-sessions” and type password.

      This way is also suitable to share the screen: login via ssh first (with X11 forwarding enabled), then start gnome-control-center and turn on screen sharing.

      (Someone can ask: if X11 forwarding works, why do I need GNOME screen sharing? I found that some apps work quite well with X11 forwarding (e. g. geany editor or gnome-control-center), but some do not (e. g. evolution is terribly slow and hardly usable). GNOME screen sharing allows me to use evolution remotely.)

      Probably, GNOME Shell has some D-Bus interface to enable sharing via the command line, without using gnome-control-center?

  9. Someletters

    The service accepts connections only on ipv6 out of the box. I consider the post incomplete.

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions