Intervene on the host file allows you to perform operations not too different fromhacking. In fact, the user has the opportunity to sabotage navigation on some Internet sites: blocking them, or perhaps redirecting them.
It’s possible edit the hosts file on the vast majority of operating systems in use: from Windows a macOSpassing through Ubuntu. The important thing is that the user you are not using a DNS server.
1. What is the hosts file and how does it work
Il file host it’s a text file which is stored in specific folders of the main operating systems: from Windows a macOSpassing through Ubuntu and other distributions of Linux.
Inside the host file they come stored host names and IP addresses with which they are associated. Modifying the hosts file allows you to perform small hacking operations: for example block a specific addressor redirect it to a different IP.
The operations may prove ineffective in case the user uses the DNS over HTTPS. But also in case you connect using your own server DNS.
To block traffic on host files it is necessary that the browser in uso points to the specified DNS server in the single operating system. In case your browser automatically enables DNS over any HTTPS interventions on the host file will be completely ignored.
2. How to edit hosts file on Windows
Per edit the hosts file Of Windows you have to access inside one protected folder named Windows. To access this folder you need to enjoy the administrator role. Otherwise it will be impossible to move, delete or even modify the files inside it.
For the rest it is atechnically very simple operation, which does not require the use of specific software. It is sufficient to resort to Block notes installed by default within your Windows PC.
To open Notepad you need to go through Start button and carry out a search in the appropriate bar. Then you need to move the mouse cursor to entry named Notepad and do click the button right.
At this point you need to select with the left mouse button the entry named Run as administrator. Open Notepad you need to go to menu named Filelocated in the top left of the screen.
From here you need to click on item called Open and enter the location of the Windows hosts file folder. Generally the address is the following: C:\Windows\System32\driver\ecc.
Before starting with the actual modification it is important change the file selection in use. You need to switch from the option named Text Documents (*.txt) toname option All files (*.*).
This step is necessary because the hosts file does not have an extension own and therefore it would be impossible to view by limiting viewing to text files only.
At this point it should be possible locate the file named Hosts. Once the file is open you can modify it to your liking. The most common hacking options are the redirection of Internet trafficrather than the blocking certain sites.
The procedure described in these paragraphs takes operating system updates as a reference Windows 10 e 11. But the process is roughly the same even if you use a device with Windows 8 o Windows 7.
3. How to edit hosts file on Ubuntu
To edit the hosts file with the Ubuntu operating system and multiple Linux distributions you have to go through the Terminal software.
Terminal is an app designed specifically for interact with the operating system. It has a command line interface, but you can also use a GUI-based external text editor.
Il path to the hosts file of Ubuntu to be inserted in the Terminal is related to the /etc/ folder. Also in this case it is a protected folder. Therefore, to view it you must necessarily have a administrator account. The same goes for editing the files inside it, including the host file.
Starting up the Vim text editor preceded by sudo command (acronym for “super user do”) you can run files as an administrator. The command to type in Ubuntu Terminal to access the hosts file folder is as follows: sudo vim /etc/hosts.
Before proceeding to execute the command, the operating system may ask you to enter your login password. In case the Vim text editor is not installed, you can give the following command to the Terminal: sudo apt install vim.
Open the host file and you can do it hacking operations to your liking: from block at the editpassing through the redirection.
The Ubuntu hosts file also features an area dedicated to the IPv6 protocol. But in most cases it is sufficient to modify the section related to the IPv4 protocol.
Per block an address you can set it in the hosts file by entering i values 0.0.0.0. This way the computer will not be able to connect to the address in question, generating an error like this Can not connect.
4. How to edit the hosts file on macOS
Also for edit the hosts file are macOS you have to go through the app Terminal: the software to interact with the operating system, which was mentioned in the previous paragraphs.
And also on macOS it is possible to take advantage of thecommand line editor interior, as well as it is possible to opt for a external text editor GUI based.
To access the macOS hosts file you need to go through the /etc/ folder. Again, once inside the hosts file, you can proceed with hacking interventions to your liking.
For example, for block a site it’s possible redirect it to 0.0.0.0. This way the proprietary Apple Safari browser will not be able to reach the changed address.
To know more: Hackers: who are they and how do they operate?