• Welcome to BOINC-AUSTRALIA FORUM.

News:

If you have forgotten your password use your email address to reset HERE

Main Menu

Chrome Remote Desktop for Ubuntu 24.04

Started by Dingo, December 03, 2025, 06:04:52 PM

Dingo

I created a script to install Chrome Remote Desktop on Ubuntu 24.04. 

Run these commands in a Ubuntu 24.04 terminal.

sudo nano crd-setup.sh  # Paist the script below into a file using nano
sudo chmod +x crd-setup.sh  # makes the file executable
sudo ./crd-setup.sh  # run the script
The script will run for a while then it will stop and ask you for some test. 

Open https://remotedesktop.google.com/headless in a browser somewhere

Press begin to setup an new machine
You have already installed all the required software so just Press Next
Click Authorise
Click the box on the right of Debian Linux to copy the text

go back to the script and paist it in where the script stopped.

Follow the instructions to complete.

#!/usr/bin/env bash
set -euo pipefail

# Chrome Remote Desktop installer for Ubuntu 24.04
# Usage: save as crd-setup.sh, make executable, then run: sudo ./crd-setup.sh
# The script is interactive and will prompt for the pairing command from Google.

CRD_USER="crduser"
DEB_URL="https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb"
TMP_DEB="/tmp/chrome-remote-desktop_current_amd64.deb"

function info { printf "\n\033[1;34m==>\033[0m %s\n" "$*"; }
function warn { printf "\n\033[1;33m!!\033[0m %s\n" "$*"; }
function die  { printf "\n\033[1;31mERROR:\033[0m %s\n" "$*"; exit 1; }

if [[ $EUID -ne 0 ]]; then
  die "Please run this script with sudo or as root: sudo $0"
fi

read -rp "Set up Chrome Remote Desktop on this machine now? [y/N]: " REPLY
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
  info "Aborting per user request."
  exit 0
fi

info "Creating user ${CRD_USER} (if it already exists this will continue)..."
if id -u "${CRD_USER}" >/dev/null 2>&1; then
  info "User ${CRD_USER} already exists. Ensuring groups..."
  usermod -aG sudo,boinc "${CRD_USER}" || true
else
  useradd --create-home --shell /bin/bash "${CRD_USER}"
  usermod -aG sudo,boinc "${CRD_USER}"
  passwd "${CRD_USER}"
fi

info "Updating apt and installing base dependencies..."
apt update
apt install -y wget lsb-release gnupg2 xfce4 xfce4-terminal ca-certificates

info "Downloading Chrome Remote Desktop package..."
wget -O "${TMP_DEB}" "${DEB_URL}"

info "Installing Chrome Remote Desktop package and fixing dependencies..."
dpkg -i "${TMP_DEB}" || apt -f install -y

info "Configuring CRD XFCE session for ${CRD_USER}..."
sudo -u "${CRD_USER}" bash <<'EOF'
set -e
mkdir -p ~/.config/chrome-remote-desktop
printf '%s\n' "exec /usr/bin/xfce4-session" > ~/.chrome-remote-desktop-session
chmod +x ~/.chrome-remote-desktop-session

mkdir -p ~/.config/autostart
cat > ~/.config/autostart/terminal.desktop <<EOT
[Desktop Entry]
Type=Application
Exec=xfce4-terminal
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Terminal AutoLaunch
Comment=Open terminal on session start
EOT
EOF

info "Enabling linger so CRD user services run when not logged in..."
loginctl enable-linger "${CRD_USER}"

warn "Before continuing, open a browser and go to: https://remotedesktop.google.com/access"
warn "Click Turn On and choose Debian/Ubuntu. Copy the full start-host command they show."

read -rp "Paste the full start-host command exactly as shown (single line): " PAIR_CMD_RAW
if [[ -z "${PAIR_CMD_RAW// /}" ]]; then
  die "No pairing command provided. Aborting."
fi

# Ensure the command includes the user name flag
if [[ "${PAIR_CMD_RAW}" != *--user-name* ]]; then
  PAIR_CMD_RAW="${PAIR_CMD_RAW} --user-name=${CRD_USER}"
fi

info "Writing pairing command to a script and executing it as ${CRD_USER}..."
# Create a small script owned by the CRD user to avoid quoting/eval issues
PAIR_SCRIPT="/tmp/crd-pair-$$.sh"
cat > "${PAIR_SCRIPT}" <<EOF
#!/usr/bin/env bash
set -euo pipefail
${PAIR_CMD_RAW}
EOF
chmod +x "${PAIR_SCRIPT}"
chown "${CRD_USER}:${CRD_USER}" "${PAIR_SCRIPT}"

# Run the pairing script as the CRD user
sudo -u "${CRD_USER}" /bin/bash "${PAIR_SCRIPT}"

info "Cleaning up temporary pairing script..."
rm -f "${PAIR_SCRIPT}"

info "Starting and enabling the chrome-remote-desktop service for the user..."
systemctl daemon-reload || true
systemctl restart "chrome-remote-desktop@${CRD_USER}.service" || true
systemctl enable --now "chrome-remote-desktop@${CRD_USER}.service" || true

info "Setup complete. Check the status and logs if anything looks wrong."
printf "\nUseful commands to debug:\n"
printf "  \033[1m%s\033[0m\n" "systemctl status chrome-remote-desktop@${CRD_USER}.service"
printf "  \033[1m%s\033[0m\n" "journalctl -u chrome-remote-desktop@${CRD_USER}.service -b --no-pager"
printf "  \033[1m%s\033[0m\n" "sudo -u ${CRD_USER} cat /home/${CRD_USER}/.chrome-remote-desktop-session"

exit 0







Have a look at the BOINC@AUSTRALIA

Facebook Page and join and also the Twitter Page.

Proud Founder and member of BOINC@AUSTRALIA
My Luck Prime 2060937 digits.
Have a look at my  Web Cam of Parliament House Ottawa, CANADA