ED 290: Chrome Desktop on a Cloud Linux Server (10 pts extra)

What You Need

Purpose

To get a graphical desktop on a headless Linux cloud server so you can use graphical apps like Wireshark and Firefox.

Installing Chrome Remote Desktop on the VM instance

On your Google Cloud Linux server, in an SSH window, execute these commands:
wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb
sudo apt update
sudo dpkg --install chrome-remote-desktop_current_amd64.deb
sudo apt install --assume-yes --fix-broken

Installing the Xfce Desktop Environment

On your Google Cloud Linux server, in an SSH window, execute these commands:
sudo DEBIAN_FRONTEND=noninteractive apt install --assume-yes xfce4 desktop-base
sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/xfce4-session" > /etc/chrome-remote-desktop-session'
sudo apt install --assume-yes xscreensaver
sudo systemctl disable lightdm.service

Installing Firefox

On your Google Cloud Linux server, in an SSH window, execute this command:
sudo apt install firefox-esr -y

Creating a Sudo User

You'll need this user to perform sudo commands in the graphical interface.

On your Google Cloud Linux server, in an SSH window, execute this command:

sudo adduser super
Enter a password of your choice.

On your Google Cloud Linux server, in an SSH window, execute this command:

sudo usermod -aG sudo super

Configuring an Authorization Key

On your local computer, in Chrome, go to: https://remotedesktop.google.com/headless

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.

On the Set up another computer page, click Begin.

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

Click Authorize.

A new window pops up. Click your Gmail address.

Click Allow.

A "Set up another computer" page appears, with commands to execute for Windows and Linux, as shown below.

Copy the Linux command and execute it on your Linux cloud server.

You'll be prompted to enter a computer name and a PIN, as shown below.

Note: You might want to save these commands in file named google-remote-desktop on your Linux server so you can reconnect more easily after a reboot.

Connecting to the VM instance

On your local computer, in Chrome, go to

https://remotedesktop.google.com/

At the top right, click "REMOTE ACCESS", as shown below.

Click your computer name.

Enter your PIN.

You see a Linux desktop, as shown below.

In the Panel box, click "Use default config".

Opening Firefox

On your Linux desktop, right-click and click Applications, Internet, "Firefox ESR", as shown below.


Flag ED 290.1: User-Agent (10 pts extra)

In Firefox, go to

https://httpbin.org/get

The flag appears, covered by a green rectangle in the image below.


Executing ifconfig

Right-click your Linux desktop and click "Open Terminal Here".

Execute these commands, one at a time, to verify that your super account works:

ifconfig
su super
sudo ifconfig
Enter the super password when you are prompted to.

The "ifconfig" command is not available for normal users, but it works after you use "sudo", as shown below.

Optional: Installing xfce4-terminal

While running as super, execute this command:
sudo apt install xfce4-terminal
Now right-click the desktop and click Applications, System, "Xcfe-Terminal" to get a better Terminal window.

Sources

Setting up Chrome Remote Desktop on Compute Engine


Posted 11-21-19
adduse command corrected 11-23-19
Snap replaced by firefox-esr 1-30-2020