Skip to content

Instantly share code, notes, and snippets.

@corporatepiyush
Last active June 13, 2024 10:57
Show Gist options
  • Save corporatepiyush/7ebc13a355f70a8b9617488e86c174d1 to your computer and use it in GitHub Desktop.
Save corporatepiyush/7ebc13a355f70a8b9617488e86c174d1 to your computer and use it in GitHub Desktop.
Block ads and malware for MacOS and Linux
# Protection from Malicious Domain (ads, malware, hack scripts, fakenews and gambling )
# You may not be doing it but various apps installed on your system doing it internally, so having ad blocker in Browser does not helps.
# Execute below command in your terminal once every week.
sudo chmod 774 /etc/hosts
curl https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts > hosts
sudo mv hosts /etc/hosts
sudo chmod 644 /etc/hosts
# Protection from Malicious Domain (ads, malware, hack scripts, fakenews and gambling ) for MacOS.
# You may not be doing it but various apps installed on your system doing it internally, so having ad blocker in Browser does not helps.
# Execute below command in your terminal once every week.
sudo chmod 774 /private/etc/hosts
curl https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts > hosts
sudo mv hosts /private/etc/hosts
sudo chmod 644 /private/etc/hosts
# Protection from Malicious Domain (ads, malware, hack scripts, fakenews and gambling ) for Linux servers in cloud. This is much restricitve version
# Execute below command in your terminal once every week.
sudo chmod 774 /etc/hosts
curl https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts > hosts
sudo mv hosts /etc/hosts
sudo chmod 644 /etc/hosts
# Protection from Malicious Domain (ads, malware, hack scripts, fakenews and gambling ) for MacOS machine as server
# Execute below command in your terminal once every week.
sudo chmod 774 /private/etc/hosts
curl https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts > hosts
sudo mv hosts /private/etc/hosts
sudo chmod 644 /private/etc/hosts
nmcli connection show --active
# here instead of "wiredProfileCustom", put the actual name specific to your machine
sudo nmcli connection modify "wiredProfileCustom" ipv4.dns "1.1.1.3"
sudo nmcli connection modify "wiredProfileCustom" ipv4.ignore-auto-dns yes
sudo nmcli connection up "wiredProfileCustom"
nmcli connection show "wiredProfileCustom"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment