Hosts as administrator. How to change the hosts file. Hosts location

Editing the hosts file is often used to protect children from visiting unwanted sites, eliminating the effects of viruses, etc. Despite the simplicity of the technique, many users encounter a number of problems, among which the computer’s stubborn reluctance to save changes made to hosts comes to the fore. There are several reasons for this behavior, which we will discuss below. The first thing worth remembering is to change hosts file Only a user with administrator rights can do this; those with a “simple” account are doomed to failure. But sometimes even the “administrator” gets a refusal.

File attributes

Open the folder with the file. Let us remind you that it is usually located at C:\Windows\system32\drivers\etc. Don’t rush to open it and make changes, first click on the file right click and select "Properties".

At the bottom of the “general” tab there is a “Read Only” option.

If it is checked, you will not be able to save the changes. Windows will prompt you to save hosts as text file. Even if you specify the correct option “all files,” the computer will ignore the user’s wishes and a useless text file will appear in the folder. Therefore, be sure to uncheck the box, and only then edit the file.

Changing the Read Only attribute is a required step. Unfortunately, this solution is sometimes not enough.

Admin Notepad

If there is no Notepad application icon on the desktop, open the Start menu and write the word “notepad” in the bottom line.

Right-click on it and select “run as administrator” from the drop-down list.

Using the Ctrl+O key combination, we call up the file opening window and go to a familiar address. Make sure the bottom right line says “all files” and select hosts. Make changes and save.

Security Issues

If the previous method does not help, you will have to explain your rights to Windows. Right-click on the hosts file and select “properties”. This time you will have to go to the “security” tab. Uncheck the “Deny” column and check the next “Allow” column.

If other people use the computer besides you, try to remember or write down the changes so that after editing you can return everything to its place. Click OK, the system will warn you about the consequences. We agree.

Viruses and antiviruses

Didn't help? A vigilant antivirus may be the culprit. Many of them have a function to block the hosts file so that malware didn't make any edits. Even if you disable the defender for a while, there is every chance that the antivirus will remove the lines you entered. In this case, add hosts to the list of exceptions, which is in every serious antivirus program. Each program has a slightly different procedure, so you'll have to check the appropriate help section for help.

You already understand that a problem with access can arise due to a virus that makes its changes to the hosts and then takes care of their safety. In this case, you can download Dr.Web CureIt! or similar Kaspersky Virus product Removal Tool. Both utilities are free and are excellent at removing pests that have settled on your hard drive.

Editing the hosts file in safe mode

The procedure differs little from the method where the file was opened through Notepad, but the entire operation is performed in safe mode.

First, reboot the computer. As soon as it turns on, before the OS starts loading, press the F8 key several times. The computer will prompt you to select a source from which to boot, select hard drive. Next, press F8 again and select the option “ Safe Mode" Lines will run across the screen, then a low-resolution black window will appear.

Through “Start” we launch “Notepad” and follow the algorithm described above. After saving the file, you can restart your computer.

Launch the Command Prompt program on the system. To do this, go to the “Start” menu - “All Programs” - “Accessories”. After this, left-click on the “Command Prompt” item. From the list of options that appears, select “Run as administrator.” If necessary, enter the required password if you are using a Guest or regular user. A black window will appear in front of you, in which you will need to enter the command notepad C:\Windows\System32\drivers\etc\hosts. After correct input, the Notepad editor window will appear in front of you, which will be opened with administrator rights necessary to change and edit the document.

Modify the file as per your requirements. To add a resource you don’t want to visit, enter a line like “127.0.0.1 site_address”, where 127.0.0.1 blocks access to the site from the current computer, and “site_address” is the Internet address of the resource to which you want to block access.

Opening a file directly from the editor window

You can also open the hosts file without using command line. To do this, go to the “Start” - “My Computer” - “Local Disk C:” directory. In the list of directories, select Windows – System32. In the list of programs that appears, find a file named Notepad (notepad.exe). Right-click on the document and select “Run as administrator.” If necessary, enter the password for the administrator account in the system and click “OK.” A Notepad window will appear in front of you. Go to the menu "File" - "Open".

Through the directory that opens, go to the folder “Computer” - “Local drive C:” - Windows – System32 – drivers – etc. In the list of files, select hosts and start editing it. After making the necessary changes, click "File" - "Save". If you cannot find the hosts file in the specified folder, use the “All files” switch, available in the lower right corner of the “Open” window immediately after the “File name” line.

You can also change the hosts file under an administrator account through Explorer. Click "Start" - "My Computer" and then go to "Local Drive C:" - Windows - System32 - drivers - etc. If the file does not appear in the list, go to the "Tools" - "Folder Options" menu. Select the View tab and then click Display hidden files" Click "Ok" to apply the changes. After that, right-click on the hosts file and select the “Open with” menu.

The hosts file contains tables of correspondence between domain names and network addresses. Address mapping information queried from the table in the hosts file takes precedence over information queried from the DNS server. As you know, each website address on the Internet (domain name) has its own IP address (network address), through which network equipment finds the requested website on the network. An entry in the hosts file eliminates the need for network equipment to request from the DNS server the IP address corresponding to the site address entered in address bar browser, which ultimately slightly speeds up the site loading speed.

And if you make an entry in the hosts file in which the site address on the Internet is set to the local IP address 127.0.0.1 (Localhost), you can thus block access to this site.


Starting with Windows 2000, the default hosts file is located at local disk with the operating system at C:\Windows\System32\drivers\etc(if the system is installed on drive C).


For editing hosts V operating system Windows 10 required any text editor, including built-in Windows Notepad or WordPad running with administrator privileges, or a special program. Network address and the corresponding domain name are written on one line, with one or more spaces between the entries. Comments are marked with a pound sign #.

1 way. Changing hosts using the command line.

You can open the hosts file for editing with the ability to save changes using the command line. We can open it using the search. Enter in the search field cmd and launch the command line as administrator.

Then enter the command in the command line field:

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

where notepad is the name of the program (Notepad) and C:\Windows\System32\drivers\etc\hosts is the path to the hosts file (if the system is installed in another partition, specify the letter of the partition on which the system is installed) and press Enter.

2 Method. Using Notepad from an administrator account.

As mentioned above, administrator rights are required to edit the hosts file. The administrator account is disabled by default in Windows. To enable it, you need to run the command line as an administrator.


In the command prompt window, enter the command net user Administrator /active:yes and then press the Enter key.

A report appears indicating that the command completed successfully.


Then log in under the newly created administrator account. As an administrator, we can easily make changes to the hosts file and save changes. Go to the folder located at C:\Windows\System32\drivers\etc, and from context menu, called by the right mouse button, select “Open with”.


Then select the program that we want to open (for example, Notepad) and click “OK.”

3 way. edit the hosts file using Notepad from the user account.

The second method does not require authorization as an administrator, however, if this account is activated and a password is set for it, then at some steps the system will require you to enter it.
Our task is to launch the editor with administrator rights and open and edit the hosts file in it. We will use Notepad as an editor. To open it, we can enter the word notepad in the field of the built-in search engine, and then by calling up the context menu with the right mouse button, select “Run as administrator”.

Or go to the folder at C:\Windows\System32, find the notepad file in it and run it as an administrator by clicking the corresponding context menu item.


In the editor window that opens, click “File” → “Open”.


Next, specify the path to the hosts file (C:\Windows\System32\drivers\etc) and click open.

4 way. Using the Hosts File Editor program.

Another way is to use special programs to edit hosts. One such program is Hosts File Editor. You can download it from the link http://hostsfileeditor.codeplex.com.
After filling in the appropriate table cells, click “Save”.


We can open the text version of the hosts file from the Hosts File Editor program and see what happened.



IN this manual Let's pay attention to how to change the hosts file in Windows 10, get acquainted with the meaning and tasks of this seemingly unremarkable text document, find out where it is located and get acquainted with cases when changes in hosts do not lead to the desired result.

Initially, you should know that all the information given in the article is equally relevant for Windows 7 and 8 in any edition.

What is this?

Hosts (without extension) is a text document containing a list of domain names and IP addresses that must be used to broadcast them. This file has higher priority than the DNS server provided by your ISP. Its contents can be changed by any computer user with system administrator privileges.

Through the skillful use of hosts, you can speed up the loading of web resources and block slow ones.

Hosts location

This small section is created for those who do not know where the hosts file is located in Windows 10.

The document is located in the same path as before, in the etc directory at Windows\System32\driver. It has no extension, but can be read by any text editor, be it Notepad++ or the standard Notepad integrated into Windows 10.

The location of this document can be changed, which the user rarely needs. Still, it is useful to know about such a function. Everything is done as follows.

  1. We call the system database editor by executing “regedit” in the “Run” line or Windows 10 search.
  2. Let's go to the HKLM section.
  3. In the SYSTEM subsection, go to the path CurrentControlSet\Services\Tcpip.
  4. Open the Parameters branch.
  5. We change the value of the “DataBasePath” parameter to a new path where the current hosts will be transferred.


Editing hosts

Only administrators or administrators can open the file in save changes mode. accounts with the appropriate rights.

1. To do this, launch a text editor (let’s look at the integrated Notepad as an example) as an administrator. Notepad can be launched using the search bar.


2. Through the “File” item, call the command to open documents or press the key combination Ctrl + O.

3. Select “All files” from the drop-down list on the right.

4. Specify a document called hosts.


By default, all lines in a document begin with a # character, indicating a comment. That is, functionally, the document does not contain any information.


Editing consists of adding a new line, where the first number is the IP address, and separated by a space is the url of the web resource where the browser or any other application will be redirected when requesting the specified IP.

To block a resource, enter a line like “127.0.0.1 www.adres.com” (in the example, blocking the VKontakte site).


Sometimes you have to change the access rights to a file through the “Security” tab in the hosts properties and even become its owner.

Restoring the original host in Windows 10

The original hosts text document, as noted, is functionally absolutely clean and does not in any way affect the operation of the computer. If, after installing a program, this document has been changed, and you don’t know how to return everything back or there is no file at all specified address, and its location in the above-mentioned registry branch has not changed, perform the following operations.

1. Using the context menu in any folder, be it the Desktop or the directory itself, etc, create a text document and rename it hosts without an extension.

You may need to enable the display option to do this file extensions in File Explorer options in Control Panel. In the “View” tab, check the box next to the appropriate option.

When renaming, we agree that next time the file may not open correctly.

2. If the folder for creating the text document was not etc, copy it to this directory located at Windows\System32\drivers.

Problems with hosts operation

Changes made to hosts should take effect immediately without requiring a computer restart. There are times when the changes made do not work. Here you need to check the correctness of the adjustments made. If everything is correct, we make such an attempt.

  • Call the command line through search with administrator rights.
  • Run “ipconfig /flushdns” in it and close the cmd window.
  • Let's check if the problem is fixed.

If not, disable the proxy server.

1. Go to “Browser Options” in the Control Panel, switching the appearance of its icons to “Icons”.

2. In the “Connections” tab, click on the icon responsible for setting up the network.


3. Uncheck all the boxes and apply the new system configuration.


This should put an end to solving the problem.

Depending on your computer settings, sometimes if necessary make changes to system file hosts This can be done, but in some cases it can’t. More precisely, changes are made without problems, but saving the file with them is no longer possible. This comes from doing this required with administrator rights. Now we'll figure it out how to save changes to Windows hosts 10 , 8 and 7 by opening this file with administrator rights.

  1. Launch the search bar (magnifying glass icon).
  2. Enter the query “ Notebook».
  3. On the found Notepad application, right-click and select “Run as administrator”.
  1. In the Notepad that opens, select the “File” menu.
  2. Click on the “Open...” item.

  1. Paste the path into the explorer line: C:\Windows\System32\drivers\etc
  2. Instead of file type " Text documents(*.txt)" select "All files".
  3. Double click on the hosts file.

Now in this file you can make all the necessary changes and save them without any problems by selecting the “File” menu - “ Save».

What is the hosts file for in the Windows 10 operating system?

The hosts file is designed to assign specific IP addresses to specific sites. Most often it is used to block entry from a computer to some Internet resources. For example, record 127.0.0.1 test.ru, added to the very bottom, will block access to the test.ru site. Changes to hosts can be made either by some malicious programs or by the user himself, who needs to restrict access to a certain resource on the global web - for example, to sites where the activation of an illegally installed program is checked.



2024 wisemotors.ru. How does this work. Iron. Mining. Cryptocurrency.