Files
gists/systemscripts/disable_ubuntu_telemetry.sh

33 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Check if script is run as root
if [ "$EUID" -ne 0 ]; then
echo "Please run this script with sudo."
exit 1
fi
# Explicitly decline data collection for ubuntu-report (if it was not removed)
echo "Declining data collection for ubuntu-report..."
if command -v ubuntu-report &> /dev/null; then
ubuntu-report -f send no
fi
# Remove telemetry packages
echo "Removing telemetry packages..."
sudo apt purge -y ubuntu-report popularity-contest apport whoopsie apport-symptoms
# Prevent packages from being reinstalled
echo "Preventing telemetry packages from being reinstalled..."
sudo apt-mark hold ubuntu-report popularity-contest apport whoopsie apport-symptoms
# Block telemetry domains
echo "Blocking telemetry domains..."
sudo bash -c 'echo "127.0.0.1 www.metrics.ubuntu.com" >> /etc/hosts'
sudo bash -c 'echo "127.0.0.1 metrics.ubuntu.com" >> /etc/hosts'
sudo bash -c 'echo "127.0.0.1 www.popcon.ubuntu.com" >> /etc/hosts'
sudo bash -c 'echo "127.0.0.1 popcon.ubuntu.com" >> /etc/hosts'
# Disable error reporting in settings (requires GUI interaction)
echo "To fully disable telemetry, ensure 'Send error reports to Canonical' is set to 'Never' in Settings → Privacy → Diagnostics."
echo "Telemetry disabling completed."