18.07.2023

How to open hosts. The hosts file - where it is located, how it should look, how to edit and save. Where is hosts located


Apparently, many users very often face the fact that sometimes when a virus infection of a computer occurs, when installing hacked or illegal software, it is recommended to make some changes to the hosts file. What kind of system component this is, ordinary users usually do not even guess, not to mention the knowledge of how to open the hosts file and what changes can (and can) be made to it. That is why it is worth dwelling on understanding its functional purpose in more detail.

What is the hosts file, and what information is stored in it?

For now, let's leave aside the questions related to how to open the hosts file, and let's see what kind of object it is and why it is generally needed in the system.

If we give the simplest explanation, we can immediately note the fact that this file, in its essence and content, is the most common text document, although it does not have an extension. Yes Yes exactly! Even if the extensions for all registered file types are set in the Explorer, it will not be indicated for this object. And it's not just done. The fact is that the information stored in this file is designed to match domain names with the IP addresses of the requested Internet resources.

Roughly speaking, when you enter a website address in a browser, the system first accesses this particular file, and only then does it validate at the DNS server level. In general, this component can to some extent be called a kind of local DNS server built into Windows or any other system. As for the information that is written in the file, the main content is by and large just a descriptive part, and the main interest is the commands that are specified for the local host, which in all cases has the address 127.0.0.1. What does this mean? This means that by changing the parameters specified in this file, you can either redirect to other resources, or generally restrict access to some sites, prohibiting both the system and programs that try to access them from connecting. Thus, its priority is higher than even the DNS server.

Why do viruses most often attack this file?

From the point of view of the security of any computer system that has access to the Internet, this component, due to its priority parameters, is almost one of the main targets that are attacked by various types of virus threats. Why is that? Yes, only because after changing some records, the threat can gain control not only over the connection, but also redirect the user to all sorts of dubious, advertising or fake resources on the Internet, for example, in order to steal personal data. And the presence of advertising seems to be far from the worst possible consequences.

Let's assume that the virus has registered in the hosts file a redirect to a fake banking page. The user seems to enter the legal (official) address of the resource, but then, without guessing anything, gets to a completely different page, which may look like the original one. Then he enters his logins and passwords to access personal banking operations, and as a result, say, all funds disappear from his card. That is why access to the hosts file for the purpose of editing is blocked by default in the system, even if you are an administrator at least three times (for Windows 7 and higher). But how to open the hosts file if it is really necessary? There are several ways to do this, which we'll talk about a little later, but for now let's see where this object is located.

Where is the hosts file in Windows?

In all Windows systems, finding this object is not difficult. For convenience, we will consider modifications of system 7 and higher. It is enough to go to the “Explorer” in the main directory of the system, go to the System32 directory, open the drivers folder and enter the etc directory.

If you need to do it easier, you can set the search through the Run menu using the % systemroot% or % WinDir% attributes, after which all the folders that are navigated through are sequentially indicated through the left slash.

How to open the hosts file in Windows 7 or any other OS of this family for viewing?

So, with the content and location of the file sorted out a bit. Now, based on the fact that this is really a text document, let's see how to open the hosts file using Notepad or any other text editor. If we are talking only about viewing, and not about editing the content, you can open it either in an already running program, selecting all files from the list of types of objects to be opened, or open it through the "Explorer", where the item "Open with" is selected in the RMB menu on the file. help…”, followed by the standard Notepad application or any other similar application of this class.

Please note that despite the fact that this object belongs to text files, it will not be possible to open it in editors like Word, since even the etc folder will not be displayed in the list. But if you use the item "Open with ...", you can perform such an operation without problems. But in both cases, saving the changes will not work.

How to open hosts file as administrator?

But sometimes you really need to edit the file. But how can I open the hosts file with Notepad so that the changes can be saved? In this case, the text content processing program itself must be run exclusively as an administrator. For Notepad in Windows 7, this can be done through the Run console by typing the notepad command and ticking the start item with admin rights. If there is no such item, you can run the Notepad.exe file as an administrator in the "Explorer" (it is located in the root directory of the Windows system).

Another technique is to create a new task in the "Task Manager" and enter the above command in the console marked as "start as administrator". After making changes, you can save the hosts file with the standard shortcut Ctrl + S.

How and what changes can be made to the contents of the hosts file?

As for the changes, they basically come down to blocking a site by entering its address after the last two lines using a hash symbol and the address of the local host.

So, for example, if some program with a hacked license (or offline registration using a key generator) constantly accesses the official website of the developer, there is nothing easier than blocking the connection. In this case, the application will “think” that there is no Internet connection and will not check the license.

Finally, speaking about how to open the hosts file, we should not forget that some portable anti-virus programs, when threats are detected, make changes to the contents of this object on their own. Therefore, deleting entries created under the auspices of such security applications is not recommended. And in general, without the need for this object, it is better not to touch it at all.

The inconspicuous hosts file in Windows operating systems can cause a lot of trouble for computer users who are not aware that the simplest changes in this file can completely change the operation of sites requested through browsers. This opportunity was adopted by various scammers on the Internet, who, by making changes to the hosts file, block the work of the most popular sites among users, such as Vkontakte and Odnoklassniki. To restore their work, just open the hosts file and delete unnecessary entries from it.


As comments on previous articles on our site called and VKontakte showed, many users have problems opening the hosts file. And the point here is not only that many users lack computer knowledge. Also, attackers improve their methods by making the real hosts file hidden, and leaving its fake counterpart in plain sight. In addition, in Windows Vista and Windows 7 operating systems, it is important to open the file correctly in order to be able to save the changes made to it.

Consider how to properly open the hosts file in the form of a simple step-by-step instruction.

  1. On Windows Vista and Windows 7 operating systems, log on with . Otherwise, it will be impossible to save the changes made to the file.
  2. In the search field that appears in Windows Vista / 7 immediately above the Start button after clicking it, enter the command

    notepad %systemroot%\system32\drivers\etc\hosts


    and press the Enter key on your keyboard.
  3. As a result of the previous action, the hosts file will open in the Notepad test editor, which you need to carefully review and delete unnecessary entries.
  4. When viewing, be sure to pay attention to the presence of horizontal and vertical scroll bars in the window, as there are cases when malicious entries take away from the visible part of the screen with numerous spaces or line breaks. If scrollbars are found in an open window, then move the sliders and carefully look at the screen so as not to miss the lines that block the work of sites.
Why is this method of opening the hosts file recommended? The fact is that, as mentioned above, one of the methods for hiding malicious actions by attackers is to assign the “hidden” status to the hosts file. At the same time, a false hosts file is assigned as visible, which does not contain entries that violate the performance of sites. Using the method described above, you will always open the correct hosts file, even if it is hidden.

If for some reason the previous method seems complicated to you, then you can open the hosts file in the usual way. You just need to take a few extra steps.

  1. Sign in with .
  2. hidden files on the computer.
  3. Go to C:\Windows\system32\drivers\etc\
  4. Right-click on the hosts file icon and select "Open" from the context menu that appears.
  5. In the window for choosing the program with which the file will be opened, select "Notepad" (Notepad) and click the "OK" button.
  6. Review the file and remove everything unnecessary from it.
  7. If there are two hosts files in the folder, then this means that one of them is false. To determine the real one, you need to open both files. The one in which additional entries are found will be the real one.
  8. After cleaning the hosts file, delete the false file and make the hidden files invisible again.
After editing the hosts file in Windows XP, you may need to restart your computer for the changes to take effect. In older versions of Windows, changes made are applied immediately.

Over the past year, questions regarding where the hosts file is located have been asked more and more often.

In fact, this file is very useful when making all sorts of settings related to Internet access.

In fact, for any problem with the Internet, the hosts file, one way or another, will be used. But we will talk about this further. The main question is where to find this most useful file.

If you simply enter the query “hosts” into the system search, then you will not be able to find the desired file - not everything is so simple. At least it rarely works, if at all.

Yes, a post was recorded on one of the domestic forums, where a person found this very file using the most common search, but the rest of the users could not find it in this way.

In any case, it would be useful to consider how to find the hosts file on a particular OS.

Location on the computer

Let's start, perhaps, with the still popular Windows 7 system. Here, to find the hosts file, you need to do the following:

  • Go to "My Computer", then go to "Local Disk C". Next, go to the "Windows" folder, which is highlighted in Figure 1.

Note: If the system drive is with a different designation (not C:, although most often it is C :), then the aforementioned folder called “Windows” is located on it. In any case, you should check everywhere. There is only one such folder on the computer, so this process will certainly not take much time.

  • After that, go to the "System32" folder. It will also not be difficult to find it, because there is only one such there and it is simply impossible to confuse it with anything.

No. 2. Folder "System32" in "Local drive C"

  • After going to the "System32" folder, you need to find the "drivers" folder and go to it. It will also be very easy to complete this step.

No. 3. Folder "drivers" in "Local drive C"

  • Next, you should find another folder - called "etc". It is highlighted in the figure below.

No. 4. Folder "etc" in "Local drive C"

  • Actually, in the folder called "etc" there will be the hosts file we are looking for. Perhaps it will be there only one, or other files will be located with it, which are also responsible for connecting to the Internet. Specifically, these are "networks", "services" and "protocol".
    Often they become the cause of disturbances in the network operation of the operating system, and they have to be completely removed. Therefore, you can remember the location of all these files - this will definitely be needed in future work.
    In any case, the name "hosts" of the two files will definitely not be.

Thus, you can find the hosts file in Windows 7 if you go along the path C:\Windows\System32\drivers\etc. By the way, you can open this file very simply, even if you do not follow the path indicated above.

To do this, you need a command prompt, run as administrator. It opens very easily.

You just need to open the "Start" menu, then open "All Programs", select the "Standard" folder (underlined with a red line in Figure No. 5), right-click on the "Command Prompt" item.

In the drop-down menu, you need to select the item "Run as administrator" (highlighted with a green frame in the same figure).

After that, on the command line, it remains just to write the command "notepad [path of the hosts file, that is, C:\Windows\System32\drivers\etc\hosts]" and press the Enter button on the keyboard.

It all looks as shown in Figure 6.

Accordingly, with this approach, you do not need to find anything. The system will open everything automatically. But we'll talk about opening the file in question.

As for opening hosts in other systems, such as Windows 8 and Windows 10, everything is also quite simple there. As for the eighth version of the above OS, the path is no different there.

This means that to find the desired file, you just need to go to exactly the same path - C:\Windows\System32\drivers\etc.

The only difference from the above screenshots is that there will be a slightly different interface, but otherwise everything remains exactly the same.

In the end, you can not look for it at all, but open it through the command line in the way described above.

The same situation with Windows 10 - the path remains exactly the same. Again, the difference from the above photos is only in the interface.

Below you can see a screenshot of the same file in the Windows 10 system folder.

If we are not talking about Windows familiar to us, but about Ubuntu, then the file we need is also located in the folder called “etc”.

Accordingly, to open it, you should enter a simple command: sudo gedit /etc/hosts.

Conclusion! From all of the above, one simple conclusion can be drawn - the hosts file is always located in the "etc" folder in all operating systems.

The only exceptions are the old versions of Windows - 95, 98 and ME. There it can be found right in the folder called "Windows".

So, we already know where to find this file. Now it’s worth knowing how to edit it, and why it is needed at all.

Purpose of the hosts file

To put it simply, it is needed to maintain a database of domain names.

If more complicated, then this file is needed to convert symbolic domain names (example: yandex.ru) into IP addresses that correspond to them.

The fact is that before each transition to a specific site, the computer needs to convert the symbolic name of the site into its digital designation.

And here hosts comes to the rescue. In TCP / IP networks, the same function is assigned to DNS, that is, the domain name system.

The problem is that very often attackers and all kinds of Internet content blockers, such as Roskomnadzor, use this same file to block access to various sites.

A full-fledged software is being written that makes a change to it and thereby creates significant problems when entering the World Wide Web.

However, for the aforementioned "networks", "services" and "protocol" files, this is also true.

But they can be completely removed, but such a trick will not work with hosts. So we need to know how to edit it.

How to open hosts file

One way to do this has been described above.

It consists in opening a command prompt as an administrator and writing the command “notepad [hosts file location path, that is, C:\Windows\System32\drivers\etc\hosts]” there.

As you can see, Notepad is used to open here, that is, in fact, a text editor. It is an ordinary notepad, but with a lot more variety of functions.

The problem is that it is not installed on every modern computer.

Although installing it is very simple - for this there are hundreds of sites that post Notepad installation files on their repositories, opening the file we are considering can be many times easier.

The fact is that in this case we will not need all the functionality of Notepad and you can open hosts with the most ordinary notepad.

To do this, you need to follow these steps:

  • From the very beginning, you need to right-click on the file itself and select the “Open with” item in the drop-down menu (it is highlighted with a red frame in Figure No. 8).

Note: Usually the filehostshas no extension and looks as shown in Figure 7, that is, as an icon of an empty sheet. But sometimes the system can still give it some kind of extension. This is exactly what we can see in Figure 8. Regardless of whether it has an extension or not, you should still open it only through Notepad orNotepad.

  • Next, you need to select the item "Select a program". If there is a “Notepad” in the list that opens, as in Figure No. 9, then you need to click on it and click on the “OK” button.
    If not, you should use the "Browse" button (highlighted with a red frame in Figure No. 9) and select a notepad there.

As you can see, everything is done very simply. After that, the file we need opens.

As for editing it, there are no special instructions here, everything is done in the same way as in a regular notepad.

This means that you can select some part, delete it with the Backspace button on the keyboard, and perform other actions provided by a regular text editor.

Visually, the process of finding, opening and editing the hosts file can be seen in the video below.

How to change the hosts file

Where is the hosts file - Examples for different OS

Not every user of the Windows operating system can find, know how to open and how to save the hosts file with changes. This article shows an example of how this can be done in Windows 7. In Windows XP, this file is located in the same place, I hope that in Windows Vista and Windows 8 it has not changed its location. It's just that I've never worked in whist and I'm not going to install windows 8 yet, so try to find and change it yourself. I hope that the way to open and make changes also remain similar to Windows 7.

And so the file hosts in the system is located in the system folder Windows, which is located on the "C" drive, unless, of course, you installed the system on another drive. In the Windows folder look for the folder "system 32", then folder drivers, then a folder "etc", here is the file you are looking for.

If you did not find it, then do some actions, obviously the parameter is set in the settings "Do not show hidden files, folders and drives".

Open folder "Computer", press the key Alt, an additional menu will appear in which you need to select "Tools", "Folder Options". A small window will open with folder options. In chapter "View" point to be noted "Show hidden files, folders and drives". Next, click "OK" and try again to look into the "etc" folder. The file must be in place.

Now the question arises: "How or with what to open it?", because the extension of this file is not known. It turns out that everything is very simple, you can open this file using notepad. To do this, double-click on the file name, an additional window will open with programs to open it, from which you need to select "Notepad" and click OK.

A text document will open with the following content:

This is where you will make changes. All entries below the lines with the first "#" sign indicate blocked addresses and Internet sites.

Let's experiment by blocking access to the VKontakte website. To do this, add the following to the file:

The site is now closed. In a similar way, you can restrict access to other sites that for some reason you do not want to view or, for example, you want to hide pornographic sites from children.

Now close notepad and try to open the VKontakte website.

That does not work? Naturally, because access to it is closed. To open access, do the opposite, remove the line with the specified site from the hosts file. Don't forget to save your changes.

1. If you are a complete teapot, then first think a few times before changing something, or don’t touch anything at all, but contact a specialist who can help you. If you still decide to make changes yourself, then in case of any problems, blame yourself. With this file jokes are bad.

2. If you really want to try it, at least make a copy of the file before making changes by copying it to another location. If something goes wrong, it will be possible to move the copy of the file back to the folder with the original file, with the consent to replace it.

3. If you did not make a copy of the file and after your self-confidence, the computer began to act naughty, try to find an identical file on the Internet, download it and replace it with your own, or delete all lines in the hosts file up to the lines with the “#” sign. Don't forget to save.

4. Before each attempt to make any changes or settings, first think about whether it is really necessary and how much you want it!

How to change the hosts file. This document is required to compare domain names (websites) fixed with symbols, as well as the corresponding IP addresses, displayed as four numbers. The user has the opportunity to enter the site both by entering its name and the above address.

A request to hosts (in Windows) has priority over DNS servers. The administrator independently controls its content. Because of this, malware often seeks to change the contents of hosts. For what? To prevent access to known resources and send users to other sources. It is clear that ads will be shown there, and sometimes a pseudo-site will open where they will ask for your passwords. As a result, fraudsters get the necessary information - access to data.

Where is hosts located

Usually located on the C drive in the Windows OS folder.

Path: C:\Windows\System32\drivers\etc\hosts

The user can manually overcome it, or simply through a command. Press "Windows" + "R". Run should open.

You must enter either the path to the document, or one of the two commands:

%systemroot%\system32\drivers\etc
%WinDir%\System32\Drivers\Etc

Opens "etc", where our file is located.


Note that it has no extension. However, it is possible to edit it in a text editor.

What hosts looks like

On Windows it contains:

Close in content to 7,8,10 versions.

All entries starting with # are comments. It explains the purpose of the file.
In hosts, information is written according to the rules: a new note from a new line, first of all, the IP address, then a space and the name of the resource. Then after # there is an option to leave a comment.

By the way, they will not affect the functioning of the PC at all. Therefore, you can generally remove all entries, and save only an empty document.

Download from here to put on your computer. It is also used as a replacement for the modified file.

Pay attention

In the case when this file on your PC is identical to this one - the standard one, you do not have problems that occur when malware intervenes.

Look at what is contained after these lines.

# 127.0.0.1localhost
# ::1 localhost

It happens that other records are inserted by some utilities.
In the example below, something has been added to the normal content using Unchecky. Some lines are inserted, with the help of which additional functions will be performed. actions.


What can be included here? For example, a set of numbers, the name of the resource after a space. To disable ads or block access to something.

When the user himself did not make additions and did not resort to the help of Unchecky, then he can absolutely confidently remove unnecessary entries from the host.

Why change the host file

This is done in order to prevent visits to the required site and to redirect the user to another source. As a rule, initially the malicious code is activated
after the utility downloaded from the Web is launched. It is then that changes in properties occur automatically.
browser shortcut. Often, this adds strings to the host.

To block a VKontakte site, it looks like this:

127.0.0.1 vk.com

Everyone has the opportunity to do it themselves. Thus:

127.0.0.1 site_name

The numbers here are the address of the user's computer.

The redirect is created by:

157.15.215.69 site_name

It works like this: scammers create a fake site with a dedicated IP. After that, an infected application gets on the PC and changes are made to the hosts.

It turns out that when typing the name of the required resource, it is transferred to another site.

How to edit hosts

You can do it yourself using a text editor. That is, in Notepad, opening the program as an admin.

For this purpose, make a Notepad shortcut to the slave. table. Or open it from the Start menu. First, on the RMB shortcut, then select "Run as administrator". An editor window will open.


2023
maccase.ru - Android. Brands. Iron. News