Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bonelifer/c055e715fa55418260af87301102a7e1 to your computer and use it in GitHub Desktop.
Save bonelifer/c055e715fa55418260af87301102a7e1 to your computer and use it in GitHub Desktop.
Remove Ubuntu telemetry
#!/usr/bin/env bash
################ Description: ###################
# This script disables telemetry opt-out under
# Ubuntu 22.04 (Codename: Jammy Jellyfish).
# It resolves telemetry domains to 0.0.0.0 and removes
# telemetry services system-wide.
################ Parameter: #####################
# None
################ Implementation: ################
# Clear the screen
clear
# Check for root privileges
if [[ $(id -u) -ne 0 ]]; then
echo "[-] Missing privileges..."
exit 1
fi
# Resolve telemetry domains to 0.0.0.0
echo "[*] Resolving \"metrics.ubuntu.com\" to 0.0.0.0"
echo "0.0.0.0 www.metrics.ubuntu.com" >> /etc/hosts
echo "0.0.0.0 metrics.ubuntu.com" >> /etc/hosts
echo "[*] Resolving \"popcon.ubuntu.com\" to 0.0.0.0"
echo "0.0.0.0 www.popcon.ubuntu.com" >> /etc/hosts
echo "0.0.0.0 popcon.ubuntu.com" >> /etc/hosts
# Remove and blacklist telemetry services
echo "[*] Removing telemetry services"
apt purge -y ubuntu-report popularity-contest apport whoopsie apport-symptoms >/dev/null 2>&1 && apt-mark hold ubuntu-report popularity-contest apport whoopsie apport-symptoms
if [[ $? -eq 0 ]]; then
echo "[+] Telemetry services successfully removed."
else
echo "[-] Removing telemetry services failed."
exit 1
fi
# Decline telemetry
echo "[*] Decline telemetry"
ubuntu-report -f send no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment