This should get you started in understanding the Hosts file and how it can help protect your computer.
It is possible to force your browser to use the DNS Server Windows specifies, but you’ll have to dig through your browser’s settings. That results in the browser completely bypassing the hosts file. A lot of browsers will enable DNS Over HTTPS automatically and use their own DNS servers. The hosts file can only be used to block internet traffic if your browser is deferring to the DNS Server specified in the Windows operating system. RELATED: How DNS Over HTTPS (DoH) Will Boost Privacy Onlineįor our purposes here, it limits the utility of the hosts file. DOH encrypts your DNS requests so that they can’t be intercepted and read by third parties that might be snooping - in general, this is a great thing. Why Isn’t The Hosts File Blocking Connections?Īll of the major modern browsers offer DNS Over HTTPS (DOH). Safari, just like a browser on Windows and Ubuntu, will be unable to connect to Facebook. Again we are going to redirect Facebook to 0.0.0.0. The file will look a lot like the hosts file found in Windows and Linux. You will notice that with Ubuntu there is also a section for IPv6. Now that it is open we can edit it to redirect Facebook into nothing.
RELATED: How to Control sudo Access on Linux Note: If you get a message notifying you that Vim is not installed, just run “sudo apt install vim” in a Terminal.
You’ll need to enter your password before the command will execute. Open up a Terminal, then enter: sudo vim /etc/hosts You’ll need to launch Vim prefaced by sudo, which is conceptually and functionally similar to “Run as Administrator” on Windows operating systems. RELATED: Define a Great Vim Profile Using. The hosts file is protected, and your regular user account will not be able to edit it. Like Windows, Ubuntu’s hosts file is located in the /etc/ folder, though here it is in the root of the drive. For this example we will use Vim, since it is one of the traditional text editors in Linux. You can use your favorite command-line editor or your favorite GUI text editor. In Ubuntu (and most Linux distributions) you can edit the hosts file directly in the Terminal. Also for more info on editing your Hosts file, check out The Geek’s article on how to create a shortcut to quickly edit your Hosts file. With the alias set you can do $ npp foo.We also were not able to get to it in Google Chrome… (check notes at the end). These can be accessed via the so-called P9 filesystem WSL provides, so you would do: Notepad++.exe \\wsl$\Ubuntu-18.04\home\user\foo.txt These can be accessed via the /mnt mountpoints, so you would do: npp /mnt/c/Temp/foo.txt With the path set you can do the usual windows: notepad++ foo.txt Now you can launch notepad++ from any folder. Unless you've changed defaults it would be in: Add to the path variable the location of Notepad++.From start menu choose edit environment settings.Set up an alias as follows: alias npp="/mnt/c/Program Files/Notepad++/Notepad++.exe" I use notepad++ with my WSL (ubuntu) as the default editor for both Windows and Linux and have setup so that it is launched from both contexts for files under either filesystem.