Edit the Windows Hosts File to Block or Redirect Websites
The Windows Hosts file is a file that Windows uses to control and map IP addresses. By editing the Hosts file, Windows can be customized to block or redirect specific websites and even protocols that are used by programs and applications.
To get started editing the Windows Hosts file, you first need to locate it. Open Windows Explorer and click on This PC or My Computer. Double-click on C:\, then the Windows folder and scroll down the page until you reach the System32 folder. Inside of that folder, open drivers and then open etc. You’ll now see several files, one of which is hosts.
Now, notice that the file type for the hosts file is listed as File. Because there is no default program set to open a file type like this, double clicking the hosts file will simply give you a Windows prompt, asking you which program you would like to use to open the file.
From this prompt, you can choose to edit the hosts file with Notepad. So, simply click to select Notepad and click the OK button. From there, Notepad will launch with the hosts file information.
This way of opening the hosts file was demonstrated to show where the hosts file is actually located within Windows, but you won’t be able to edit it because it’s a system file. In order to edit the file, you have to open Notepad first, running as an Administrator.
Click on Start and type in Notepad, but don't click on Notepad to open it. Rather, right-click the Notepad listing to bring up the context menu. Select the option Run as Administrator.
With Notepad open, select File > Open. Navigate to C:\Windows\System32\drivers\etc. You will get a blank screen that displays the prompt No items match your search. Change Text Documents (*.txt) to All Files using the drop down menu. Now, you can select the hosts file and click Open.
Adding files to the hosts file is very simple. The hosts file uses the format:
IP Address exampledomain.com
Blocking a website in Windows is as simple as typing the following into the bottom of the hosts file:
127.0.0.1 www.exampledomain.com
So, if I wanted to block a website like www.nytimes.com, I could just add the following line:
127.0.0.1 www.nytimes.com
What we are actually telling Windows is that the website www.nytimes.com should redirect to the IP address 127.0.0.1, which is just the loopback address on our local system. If you don’t have a local website setup on your computer, you’ll just get an error page in your web browser.
Pretty cool, huh!? Obviously, you can see how this can be used in several different ways: a prank, parental control, etc. If you didn’t want to block the website in that way, you could also redirect it to another website. In order to do this, you have to find the IP address of the other site first.
To do that, just open a command prompt (click on Start and type in CMD) and type in the following command:
ping examplewebsite.com
In my example, I pinged Adobe.com. The IP address is 192.150.16.117. Now I can simply plug that number into my hosts file in front of www.nytimes.com.
Now when I visit www.nytimes.com, I get redirect to Adobe.com! Nice! Note that if this doesn’t work for the websites you are entering, it could be because of the URL you are using. For example, it makes a difference if you use www.nytimes.com as opposed to nytimes.com without the www. Visit the website and see exactly what the URL is for the website you want to redirect. You should always try without the www first to see if that works.
If the website uses HTTPS like Google.com or something, it should still redirect if you use the host name. There is no way to specify the HTTPS version of a website in the HOSTS file, but it should redirect the HTTPS and non-HTTPS versions of the website if you use just the host name (i.e. google.com).
Lastly, you can use the hosts file to create simple shortcuts to your own devices on the network. For example, my router is at 192.168.1.3 on my home network, but I could add the following line to my hosts file and simply type in myrouter.com into my address bar.
It doesn’t really matter if myrouter.com is actually a website or not because the hosts file is read first and you are redirected to the IP address specified in the file. It’s worth noting that not all browsers may use the hosts file, so if it’s not working, that could be the issue. I tested it using IE, Microsoft Edge, Chrome and Firefox and it worked on all of the browsers.
Overall, the hosts file is still useful, even in Windows 10. It also still works just fine in Windows 8, 7, Vista, etc. If you have any questions, feel free to comment. Enjoy!
Looking for a way to encrypt a folder of sensitive data on your Mac? You could encrypt your entire hard drive using File Vault, but this may be overkill for most people. Luckily, OS X has a built-in feature that allows you to create an encrypted disk image containing whatever data you want inside the image.
The only way to open the disk image is to enter the password. You can copy the disk image like a normal file and it will be unreadable unless unlocked on a Mac. Overall, it’s like creating your own encrypted file container.
Also, be sure to check out my article on how to securely encrypt a USB flash drive, which is another good way of storing sensitive data.
Create Encrypted Disk Image
To create the disk image (DMG) on your Mac, first create a folder that includes all the data you want to encrypt. Note that once you create the disk image, the original unencrypted folder will still remain on your system and you should delete it immediately.
To get started, go ahead and open Disk Utility by going to Applications or by clicking on the Spotlight icon (magnifying glass) at the top right and typing in Disk Utility.
Once Disk Utility is open, go ahead and click on File – New Image – Image from Folder.
You’ll now have to choose the folder that you would like to encrypt as a disk image.
Click Open and you’ll get the Save As dialog where you have to give your new image a name and choose from a couple of options.
By default, it’ll save the new disk image in the same folder that you are encrypting. Under Encryption, you can choose from 128-bit or 256-bit AES encryption. The latter will be slower because of the stronger encryption, but your data will be better protected. When you choose any of the encryption options, you’ll be asked to enter a password.
Make sure you enter a very long and strong password because this is the only security that protects your data. If a hacker gets a hold of your file, they can try to use a brute-force attack to determine the password. Anything over 12 characters with letters, numbers and symbols will take a very long time to crack even on a really fast computer or cluster of computers.
For Image Format, you can choose from read-only, compressed, read/write, DVD/CD master or hybrid image. For our purposes, you should choose either read-only or read/write. If you choose the latter option, you’ll be able to add more files/folders to your encrypted image at a later point.
Click Save and your new image will be created. Note that if you chose 256-bit AES encryption, it could take quite a while for your disk image to be created.
Now when you go to open the image file, you’ll get a prompt asking for the password. Make sure you do NOT check the Remember password in my keychain box.
If you enter the password correctly, the image will be mounted like a drive and if you chose read/write for the Image Format, then you can add or remove items from the encrypted image just like a normal drive. When you add something to the drive, it will automatically be encrypted and protected.
Create Blank Encrypted Image
It’s also worth noting that you don’t have to necessarily create an encrypted image from a folder. You could also open Disk Utility and then click on File – New Image – Blank Image.
Here you will see a couple of more options. Firstly, you can specify the size of the disk image and the file system format. It’s recommended you stick with OS X Extended (Journaled) so that all security features are supported.
For Partitions, you can choose from Single partition – GUID Partition Map or Single partition – Apple Partition Map. All of the other settings are the same as previously mentioned.
Overall, it’s a great way to secure data on your Mac from prying eyes without having to install any third-party software or enabling File Vault on your entire system. If you have any questions, feel free to comment. Enjoy!
0 commentaires:
Enregistrer un commentaire