Setting up Chrome Remote Desktop on Compute Engine

This tutorial shows you how to set up the Chrome Remote Desktop service on a Debian Linux virtual machine (VM) instance on Compute Engine. Chrome Remote Desktop allows you to remotely access applications with a graphical user interface from a local computer or mobile device. For this approach, you don't need to open firewall ports, and you use your Google Account for authentication and authorization.

This tutorial assumes that you are familiar with the Linux command line and with installing Debian packages.

Objectives

  • Create a headless Compute Engine VM instance to run Chrome Remote Desktop on.
  • Install and configure the Chrome Remote Desktop service on the VM instance.
  • Set up an X Window System desktop environment in the VM instance.
  • Install and configure the Chrome Remote Desktop client on your local computer.
  • Connect from your local computer to the desktop environment on the VM instance.

Costs

This tutorial uses billable components of Google Cloud Platform (GCP), including:

  • Compute Engine

Use the Pricing Calculator to generate a cost estimate based on your projected usage.

Before you begin

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. Select or create a Google Cloud Platform project.

    Go to the Manage resources page

  3. Make sure that billing is enabled for your Google Cloud Platform project.

    Learn how to enable billing

This tutorial requires that you use the Google Chrome browser on your local computer. If you don't have it already, you can install it from the Google Chrome home page.

Creating a Compute Engine instance

For the purposes of this tutorial, the default 1 vCPU (n1-standard-1) machine type with Debian Linux boot disk works fine, so you don't need to change the default settings.

  1. In the GCP Console, go to the VM Instances page:

    Go to the VM Instances page

  2. Click Create.

  3. Set the instance name to crdhost.

  4. Optionally, select a region and zone that's close to you.

  5. Click Create.

    It takes a few moments to create your instance.

  6. After the instance has been created, connect to your new instance by clicking the SSH button in the instance list:

    Creating an SSH connection to the VM instance

Installing Chrome Remote Desktop on the VM instance

The next step is to install Chrome Remote Desktop on the VM instance.

  1. In the SSH window connected to your VM instance, download the Debian Linux Chrome Remote Desktop installation package:

    wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb
    
  2. Update the package manager data:

    sudo apt update
    
  3. Install the package and its dependencies:

    sudo dpkg --install chrome-remote-desktop_current_amd64.deb
    sudo apt install --assume-yes --fix-broken
    

Installing an X Windows System desktop environment

You need to install an X Window System desktop environment and window manager for Chrome Remote Desktop to use. Common options are:

  • Xfce. This is a simple, lightweight desktop environment that works well with remote connections over slower networks.
  • Cinnamon. This is a more full-featured traditional desktop environment that will be more familiar to desktop PC users. However, it uses more graphical elements and needs a fast network to run smoothly.

You can use other desktop environments, but Chrome Remote Desktop does not support 3D graphics acceleration. If you do choose a desktop environment that uses 3D graphics acceleration, you need to disable that feature, or the remote desktop service won't start.

Xfce

  1. In the SSH window connected to your VM instance, install the Xfce desktop environment and basic desktop components:

    sudo DEBIAN_FRONTEND=noninteractive \
        apt install --assume-yes xfce4 desktop-base
    

    The DEBIAN_FRONTEND=noninteractive parameter suppresses a prompt to configure a layout for a keyboard that would be directly connected to the VM instance.

  2. Configure Chrome Remote Desktop to use Xfce:

    echo "xfce4-session" > ~/.chrome-remote-desktop-session
    
  3. Xfce's default screen locker is Light Locker, which doesn't work with Chrome Remote Desktop. (The screen locker displays a blank screen and cannot be unlocked). Therefore, install XScreenSaver as an alternative:

    sudo apt install --assume-yes xscreensaver
    
  4. Optionally, install the full suite of Linux desktop applications, including the Firefox browser, LibreOffice office application suite, and the Evince PDF viewer:

    sudo apt install --assume-yes task-xfce-desktop
    

Cinnamon

  1. In the SSH window connected to your VM instance, install the Cinnamon desktop environment and basic desktop components:

    sudo DEBIAN_FRONTEND=noninteractive \
        apt install --assume-yes cinnamon-core desktop-base
    

    The DEBIAN_FRONTEND=noninteractive parameter suppresses a prompt to configure a layout for a keyboard that would be directly connected to the VM instance.

  2. Set your Chrome Remote Desktop session to use Cinnamon in 2D mode (which does not use 3D graphics acceleration):

    echo "cinnamon-session-cinnamon2d" > ~/.chrome-remote-desktop-session
    
  3. Optionally, install the full suite of Linux desktop applications, including the Firefox browser, the LibreOffice office application suite, and the Evince PDF viewer:

    sudo apt install --assume-yes task-cinnamon-desktop
    

Regardless of which desktop environment you've installed, complete the installation process by following these steps:

  1. Disable the display manager service on your instance. There is no display connected to your instance, so the display manager service won't start.

    sudo systemctl disable lightdm.service
    
  2. Optionally, install the Chrome browser on your instance:

    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    
    sudo dpkg --install google-chrome-stable_current_amd64.deb
    sudo apt install --assume-yes --fix-broken
    

Configuring and starting the Chrome Remote Desktop service

To start the remote desktop server, you need to have an authorization key for the Google account that you want to use to connect to it.

  1. On your local computer, using the Chrome browser, go to the Chrome Remote Desktop command line setup page:

    https://remotedesktop.google.com/headless

  2. If you're not already signed in, sign in with a Google Account. This is the account that will be used for authorizing remote access.

  3. On the Set up another computer page, click Begin.

  4. On the Download and install Chrome Remote Desktop page, click Next.

  5. Click Authorize.

    You need to allow Chrome Remote Desktop to access your account. If you approve, the page displays a command line for Debian Linux that looks like the following:

    DISPLAY= /opt/google/chrome-remote-desktop/start-host \
        --code="4/xxxxxxxxxxxxxxxxxxxxxxxx" \
        --redirect-url="https://remotedesktop.google.com/_/oauthredirect" \
        --name=
    

    You use this command to set up and start the Chrome Remote Desktop service on your VM instance, linking it with your Google Account using the authorization code.

  6. Copy the command to the SSH window that's connected to your instance, and then run the command.

  7. When you're prompted for a name for the computer, enter the instance name (crdhost).

  8. When you're prompted, enter a 6-digit PIN. This number will be used for additional authorization when you connect later.

Connecting to the VM instance

You can connect to the VM instance by using either a web application or by using the Chrome app.

web app

  1. On your local computer, go to the Chrome Remote Desktop (Beta) web site.

  2. Click Remote Access

  3. If you're not already signed in to Google, sign in with the same Google Account that you used to set up the Chrome Remote Desktop service.

    You see your new VM instance in the Remote Devices list. List of remote devices available to connect to

  4. Click the name of the remote desktop instance.

  5. When you're prompted, enter the PIN that you created earlier, and then click the arrow button to connect.

    You are now connected to the desktop environment on your remote Compute Engine instance.

Chrome app

Install the Chrome Remote Desktop app on your local computer:

  1. On your local computer, go to the Chrome Remote Desktop app page in the Chrome Web Store.

  2. Click Add to Chrome.

Use the Chrome Remote Desktop app to connect to the remote instance:

  1. On your local computer, enter the following URL into the Chrome address box:

    chrome://apps

  2. Select Chrome Remote Desktop.

  3. If you're not already signed in to Chrome, sign in with the same Google Account that you used to set up the Chrome Remote Desktop service.

  4. When you're prompted, click Turn On Sync.

  5. Because this is the first time you're running the Chrome Remote Desktop app, it prompts you to authorize the app for extended access permissions. If you agree, click Continue.

    You see your new VM instance in the My Computers list. (If you see a Get Started button in the My Computers list, click it to show the list of authorized computers.)

    List of computers available to connect to

  6. Click the name of the remote desktop instance.

  7. When you're prompted, enter the PIN that you created earlier, and then click Connect.

    You are now connected to the desktop environment on your remote Compute Engine instance.

If you installed the Xfce desktop, the first time you connect, you are prompted to set up the desktop panels. Click Use Default Config to get the standard taskbar at the top and the quick launch panel at the bottom.

xfce desktop showing the taskbar and quick launch panel

Improving the remote desktop experience

This section provides instructions for changing settings in order to improve the remote desktop experience.

Disable animations and effects in Cinnamon

The Cinnamon desktop uses several graphical features and animations, such as semi-transparent windows and menus that fade in and out. Because these animations take more time to render over a remote connection, it can make the user interface feel slow.

To disable these effects:

  1. In the Cinnamon desktop, select Menu > Preferences > Effects.

    Setting desktop preferences in Cinnamon

  2. Disable each of the effects:

    Disabling animation effects in Cinnamon

Disable screensavers, lock screens, and passwords

Because you're accessing your desktop from a remote computer, it's normally not necessary to use a screensaver or screen locker.

Xfce

  1. In the Applications menu, select Settings > Screensaver.
  2. Set Mode to Disable Screen Saver.

    Disabling the screensaver in Xfce

Cinnamon

  1. In the desktop, select Menu > Preferences > Screensaver.
  2. In the Settings tab, set Delay to Never and disable the two lock settings:

    Effects settings dialog in Cinnamon

The user account created by Compute Engine doesn't have a password, and most screen-locking apps can't unlock screens for users that don't have a password. However, even when screensavers are disabled, it's still possible to lock the screen from the Applications menu.

To avoid getting locked out of the remote desktop, you can set a password for your user:

  1. Connect to the instance using SSH, as you did when you first set up the instance.
  2. Create a password for the user:

    sudo passwd $(whoami)
    

    This password is required only in order to unlock the screen.

Increase the desktop resolution

If you have an ultra high-resolution monitor, you might find that the default maximum remote desktop size of 1600 x 1200 is too small. If so, you can increase it to the resolution of your monitor.

  1. Use SSH to connect to the instance.
  2. Set the CHROME_REMOTE_DESKTOP_DEFAULT_DESKTOP_SIZES environment variable to include the resolution of your monitor:

    echo "export CHROME_REMOTE_DESKTOP_DEFAULT_DESKTOP_SIZES=1600x1200,3840x2560" \
        >> ~/.profile
    
  3. Restart the service:

    sudo systemctl restart chrome-remote-desktop
    

Troubleshooting

Check the status of the Chrome Remote Desktop service

If at any point the Chrome Remote Desktop service is not responding, you can check its status by using SSH to connect to the instance and running the following command:

sudo systemctl status chrome-remote-desktop

If the service is running, you see output that includes the state active:

chrome-remote-desktop.service - LSB: Chrome Remote Desktop service
    Loaded: loaded (/etc/init.d/chrome-remote-desktop; generated; vendor preset: enabled)
    Active: active (exited) since DATE_TIME, ELAPSED_TIME

To restart the service, use the following command in the SSH window:

sudo systemctl restart chrome-remote-desktop

Get log and error information

Chrome Remote Desktop writes log information to files whose names match the following pattern:

/tmp/chrome_remote_desktop_DATE_TIME_*

You can check these log files for error messages.

Re-enable the service

If you have mistakenly disabled connections to the remote instance in the client app, you can reconfigure the service and re-enable it by following the instructions in Configuring and starting the Chrome Remote Desktop service.

Cleaning up

To avoid incurring charges to your Google Cloud Platform account for the resources used in this tutorial:

Deleting the project

The easiest way to eliminate billing is to delete the project that you created for the tutorial.

To delete the project:

  1. In the GCP Console, go to the Projects page.

    Go to the Projects page

  2. In the project list, select the project you want to delete and click Delete delete.
  3. In the dialog, type the project ID, and then click Shut down to delete the project.

Delete the Compute Engine instance

As an alternative to deleting the entire project, you can delete the VM instance you created for this tutorial:

  1. In the GCP Console, go to the VM Instances page:

    Go to the VM Instances page

  2. Select the checkbox next to the instance name you created earlier (crdhost).

  3. Click the Delete button at the top of the page:

    Deleting the VM instance

    It takes a few moments to delete your instance.

Deauthorize Chrome Remote Desktop for the instance

web app

If you no longer want to connect to the VM instance, you can disable it and remove the instance from the Remote Devices list.

  1. On your local computer, go to the Chrome Remote Desktop Remote Device list (Beta) web site.

  2. Click delete next to the instance name:

    Disabling the remote device in Chrome

  3. Click OK to confirm that the remote device connection should be disabled.

Chrome app

If you no longer want to connect to the VM instance, you can deauthorize it and remove the instance from the My Computers list.

  1. On your local computer, open the Chrome Remote Desktop app.

  2. Hold the mouse over the instance name, and then click the × button next to the instance name:

    Deauthorizing the remote desktop computer in Chrome

  3. Click the Disable button to confirm.

What's next

Was this page helpful? Let us know how we did:

Send feedback about...