Как сохранить изменения в файле hosts, если при сохранении выходит ошибка «У вас нет разрешения на сохранение файлов в этом месте. Обратитесь к администратору сети для получения разрешения»?
Как открыть файл hosts от имени администратора и сохранить его?
Если у вас есть права администратора этого компьютера, то его нужно редактировать программой, запущенной с этими правами, некоторые сторонние текстовые редакторы позволяют временно запуститься с этими правами, чтобы была возможность сохранять такие файлы, ну или в параметрах запуска задать эту возможность программе, однако потом лучше вернуть ей стандартные права, т.к. с одной стороны это небезопасно, учитывая то, что можно будет редактировать любые файлы системы, ну а еще могут наблюдаться и проблемы при открытии простых файлов.
Ну а можно и другим вариантом воспользоваться, например сохранить его под другим именем, после чего перенести этот файл в эту папку, заменив имеющийся там файл.
автор вопроса выбрал этот ответ лучшим
[поль
[146K]
5 лет назад
Для себя я сначала сохранил правильный файл hosts на диске D в отдельной папке.
Теперь если я замечаю, что в системе файл hosts изменился, то копирую на его место правильный файл hosts из папки на диске D.
При копировании появляется окно, в котором написано, что файл скопировать нельзя. Но есть в этом окне кнопка «Всё с административными правами». После её нажатия возникает другое окно: что я хочу сделать с этим файлом? Нажимаю кнопку «Заменить» и правильный файл hosts появляется на месте того, который был изменён.
Herou
[2.7K]
5 лет назад
Здравствуйте!
Откройте пуск, там в поиске введите «Блокнот» или «Notebook», дальше нажмите по нему правой кнопкой мыши и выберите «Запуск от имени администратора», потом в блокноте нажмите файл->открыть, зайдите в C:/Windows/System32/
Yurah
5 лет назад
Для внесения изменений в системные файлы я очень давно пользуюсь файловым менеджером «Far Manager«! Также для этих целей хорошо подойдёт программа «Notepad++«
С их помощью можно открывать и редактировать практически любой файл!
gigab
[53.3K]
5 лет назад
1) Запустите Блокнот от имени администратора
2) Откройте в Блокноте файл hosts и внесите изменения
3) Сохраните полученный файл
4) Если при сохранении было добавлено расширение .txt, в проводнике переименуйте файл
alexm
5 лет назад
Файл hosts это простой текстовый файл, независимо от того что у него нет соответствующего расширения. Открывается любым текстовым редактором.
Если вы работаете в доменной сети, то следуйте совету, обратитесь к администратору домена.
Если это ваш домашний компьютер, то или зайдите под именем «Администратор», или откройте notepad.exe от имени администратора (правой клавишей мыши по файлу и «запустить от имени администратора»). В обоих случаях вам должен быть известен пароль пользователя «Администратор».
Знаете ответ?
19.07.2023
Содержание
- 1 Проверка прав доступа
- 2 Отключение защиты: изменение настроек безопасности
- 3 Редактирование файла в командной строке
- 4 Применение специализированных инструментов
- 5 Проблемы со стороны используемых антивирусов
Невозможность успешно сохранить файл hosts Windows 10 – одна из самых распространенных проблем, с которой может столкнуться каждый пользователь. Под таким файлом принято рассматривать текстовый документ, в котором собрана вся актуальная информация о домене, IP-адресе, что ему соответствует.
Проблемы с сохранением возникают по причине особенностей данного документа, блокировки такого процесса установленными антивирусными программами. Иногда причина заключается в том, что пользователь не до конца понимает всю суть, специфику проведения запланированного процесса.
Проверка прав доступа
Для сохранения и дальнейшего редактирования файлов важно иметь соответствующий доступ. Такой файл «спрятан» в установочном каталоге ОС, а потому надежно защищен от несанкционированного доступа. По этой причине пользователю потребуется получить доступ для выполнения запланированных действий.
В первую очередь нужно произвести запуск «Блокнота» от имени администратора, воспользовавшись известной комбинацией «Windows Key + S». Если файл c:\windows\system32\drivers\etc\hosts недоступен для записи, нужно выбрать хосты, нажимая кнопку «Открыть». После этого происходит внесение определенных изменений с последующим их сохранением.
Отключение защиты: изменение настроек безопасности
Принимая решение купить лицензионную Windows 10, пользователь может столкнуться с проблемой, когда у него отсутствует контроль над файлом hosts. Для это следует выполнить несколько шагов с целью изменить настройки безопасности:
- Заходим в C: \ Windows \ System32 \ drivers \ etc.
- Нужно отыскать файл hosts, кликнув на пункт «Свойства».
- Нас интересует вкладка «Безопасность», где потребуется нажать «Изменить».
- На экране высвечивается список всех, кто имеет доступ к данному файлу. Если вы нашли в этом списке свое имя, нажимаем и проверяем наличие установки «Полных прав доступа». Если ваше имя отсутствует, нажимаем «Добавить».
- Вручную вводим необходимое имя, нажимая «Проверить имена», а после подтверждаем свои действия с помощью «Ок».
Таким образом, будут внесены существенные изменения в форму безопасности, а потому происходит автоматическое отключение защиты для вашего имени.
Редактирование файла в командной строке
Если были замечены проблемы, что не сохраняется hosts, нет возможности вносить изменения, потребуется воспользоваться командной строкой, введя «net user Администратор /active:yes». По завершению необходимо нажать «Enter», чтобы на экране появился отчет, свидетельствующий об успешном выполнении заданной команды.
Войти можно с помощью созданной админзаписи, которая позволяет вносить абсолютно любые изменения в любе время дня и ночи в файл hosts. Кроме того, такие изменения будут сразу же сохраняться.
Применение специализированных инструментов
Разобравшись с тем, где файл hosts находится, возникает необходимость в его редактировании. С этой целью часто используют специализированные утилиты, текстовые редакторы и прочие инструменты.
Рассмотрим сразу несколько проверенных вариантов:
- Micro Hosts Editor – популярный программный продукт, который по своему интерфейсу немного напоминает «Блокнот». Но отличие заключается в применении инструментов по изменению таблиц.
- Online Solutions Hosts Editor – еще одно уникальное приложение, в основе которого используется расширенный мастер восстановления файлов.
В зависимости от поставленной задачи перед пользователем, удастся сделать правильный выбор в сторону того или иного приложения.
Проблемы со стороны используемых антивирусов
Во многих антивирусных программах изначально предусмотрена опция запрета редактирования файла hosts, а потому возникает необходимость в предварительном отключении антивируса на ПК или лэптопе.
Для этого следуем инструкции:
- В меню «Пуск» выбираем «Средства администрирования».
- В открывшемся окошке кликаем «Конфигурация системы».
- Ищем вкладки «Службы» и «Автозагрузка», где нужно отыскать собственный антивирус, возле которого убираем установленные галочки.
- Нажимаем «Применить», чтобы сохранить все внесенные изменения.
По завершению всех действий система осуществит запрос на перезагрузку компьютера, по завершению которой антивирус не помешает редактировать файл hosts. Но после редактирования, стоит снова проделать вышеперечисленные действия, чтобы активировать антивирусную защиту.
Одна из главных ошибок каждого пользователя – несоблюдение инструкции, что приводит к нарушению правил редактирования данного файла. По этой причине следует быть внимательным и выполнять все действия шаг за шагом, не упуская важные моменты.
What is a hosts file in Windows 10?
A ‘hosts’ file is a plain text file, which maps hostnames to IP addresses. A host file helps in addressing network nodes in a computer network. A hostname is a human-friendly name or label assigned to a device (a host) on a network and is used to distinguish one device from another on a specific network or over the internet.
If you have been a tech-savvy person, you would be able to access and modify the Windows hosts file to solve certain issues or block any websites on your device. The hosts file is located at C:\Windows\system32\drivers\etc\hosts on your computer. Since it is a plain text file, it can be opened and edited in notepad. But Sometimes you may encounter ‘Access Denied’ error while opening hosts file. How will you edit the host file? This error will not let you open or edit the hosts file on your computer. In this article, we will discuss various methods to solve Can’t edit the hosts file on Windows 10 issue.
Editing a hosts file is possible and you might need to do it for a variety of reasons.
- You can create website shortcuts by adding a required entry in the hosts file that maps the website IP address to a hostname of your own choice.
- You can block any website or ads by mapping their hostname to the IP address of your own computer which is 127.0.0.1, also called loopback IP address.
Table of Contents
Make sure to create a restore point just in case something goes wrong.
Why can’t I edit the hosts file, even as Administrator?
Even if you try to open the file as an Administrator or use the built-in Administrator account to modify or edit the hosts file, you are still unable to make any changes to the file itself. The reason being that the access or permission required to make any changes to the hosts file are controlled by TrustedInstaller or SYSTEM.
Method 1 – Open Notepad with Administrator Access
Most of the people use notepad as a text editor on Windows 10. Therefore, before you edit the host file, you need to run Notepad as Administrator on your device.
1. Press Windows Key + S to bring up the Windows Search box.
2. Type notepad and in the search results, you will see a shortcut for Notepad.
3. Right-click on Notepad and select ‘Run as administrator’ from the context menu.
4. A prompt will appear. Select Yes to continue.
5. Notepad window will appear. Select File option from the Menu and then click on ‘Open‘.
6. To open the hosts file, browse to C:\Windows\system32\drivers\etc.
7. If you can’t see the hosts file in this folder, select ‘All Files’ in the option below.
8. Select the hosts file and then click on Open.
9. You can now see the contents of the hosts file.
10. Modify or make the required changes in the hosts file.
11. From Notepad menu go to File > Save or press Ctrl+S to save the changes.
It is important to note that this method works with all text editor programs. Therefore, if you use another text editor program apart from notepad, you just need to open your program with Administrator access.
Alternative Method:
Alternatively, you can open the notepad with admin access and edit the files using the Command Prompt.
1.Open the command prompt with admin access. Type CMD in Windows search bar then right-click on Command Prompt and choose Run as administrator.
2.Once the elevated command prompt opens, you need to execute the below-given command
cd C:\Windows\System32\drivers\etc notepad hosts
3.The command will open the editable host file. Now you can make the changes to the hosts file on Windows 10.
Method 2 – Disable Read-only for the hosts file
By default, the hosts file is set to open but you cannot make any changes i.e. it is set to read-only. In order to fix Access denied when editing hosts file error in Windows 10, you need to disable the read-only feature.
1.Navigate to C:\Windows\System32\drivers\etc.
2.Here you need to locate the hosts file, right-click on it and choose Properties.
3.In the attribute section, uncheck the Read-only box.
4.Click Apply followed by OK to save the settings
Now you can try to open and edit the hosts file. Probably, the problem of access denied will be solved.
Method 3 – Change the Security settings for the hosts file
Sometimes getting access to these files requires special privileges. It could be one reason that you may not be given full access, therefore, you are getting access denied error while opening hosts file.
1.Navigate to C:\Windows\System32\drivers\etc.
2.Here you need to locate the hosts file, right-click on the file and choose Properties.
3.Click on the Security tab and click on the Edit button.
4.Here you will find a list of users and groups. You need to ensure that your user name has full access and control. If your name is not added in the list, you can click on the Add button.
5.Select the user account via the Advanced button or just type your user account in the area which says ‘Enter the object name to select’ and click OK.
6.If in the previous step you have clicked on the Advanced button then click on “Find now” button.
7.Finally, click OK and checkmark “Full Control”.
8.Click Apply followed by OK to save changes.
Hopefully, now you will be able to access and edit the hosts file without any issues.
Method 4 – Change the hosts file location
Some users noted that changing the file location has solved their problem. You can change the location and edit the file thereafter put the file back to its original location.
1.Navigate to C:\Windows\System32\drivers\etc.
2.Locate the Hosts file and copy it.
3.Paste the copied file on your Desktop where you can easily access that file.
4.Open the hosts file on your Desktop with Notepad or another text editor with Admin access.
5.Make the necessary changes on that file and save changes.
6.Finally, copy & paste the hosts file back to its original location:
C:\Windows\System32\drivers\etc.
Recommended:
- Create Multiple Gmail Accounts Without Phone Number Verification
- Identify and Install Missing Audio & Video Codecs in Windows
- Fix The Diagnostics Policy Service Is Not Running Error
- 10 Ways To Fix Slow Page Loading In Google Chrome
That’s if you have successfully Fix Access denied when editing hosts file in Windows 10 but if you still have any queries regarding this article then please feel free to ask them in the comment’s section.
In Windows 11 and Windows 10, there is a specific file in the system folder called “hosts”. This file allows mappings of IP addresses to host names. For example, if you would like the host name abc.example.com to resolve to the IP address 127.0.0.1, you can add the mapping to the hosts file. So when any application tries to access abc.example.com, it would go to the IP address 127.0.0.1.
The hosts file is mostly used to block certain programs or software from being able to reach a certain host name or to redirect the host name request to another IP address. It is also often used to block (or redirect) certain websites you don’t want anyone who has access to the same computer (or any of your programs) to be able to reach the host name upon request.
See also: How to Block a Website Such As YouTube in Windows 11
If you’re told to edit the hosts file to block or redirect a certain host name to an IP address, this guide will show you where the location of the hosts file is, how to correctly edit the hosts file in Windows 11 and Windows 10, and why you were unable to save the hosts file after editing.
How to Edit Hosts File in Windows 10
Note: Edit the hosts file with caution and at your own risk. Adding and remapping any crucial host name would possibly cause some software to fail or render some features unavailable should a host name they need to connect to be inaccessible or invalid due to remap of the host name in the hosts file.
To edit or add an entry to the hosts file in Windows 11 and Windows 10, follow the steps below.
- On the Windows 11 or Windows 10 search bar, search for Notepad. Right-click Notepad from the search result and then select “Run as administrator“.
- In the Notepad, click on File, then select Open.
- In the “Open” window, click on the drop-down menu that shows Text Documents (.txt) at the bottom of the window, and then select All Files. Doing this will allow you to see all files instead of only txt files.
- Next, navigate to C:\Windows\System32\drivers\etc (Change the C: drive if your Windows is in another drive). Select the file named “hosts” then click on Open.
- To resolve a host name to a specific IP address, on a new line, enter the IP address (e.g. 127.0.0.1), followed by a space (or TAB), and then enter the host name (e.g. abc.example.com).
- When you’ve done editing, press CTRL + S keys (or File > Save) to save the changes.
What are the rules for editing the hosts file?
You can add as many mappings as you want. Make sure there is only one mapping per line. Also, make sure there is no # symbol at the beginning of the line where you add your mapping as # (commenting) means to ignore the line.
Additionally, the hosts file does not have an extension and must not have one. Thus, it cannot be opened normally by double-clicking it. You need to open it with Notepad or other text editor. We recommend Notepad as it’s the easiest to use.
Useful tip: How to Block Websites on Chrome Without Extension
Unable to save hosts file because access denied?
This is a common error users receive when they try to edit the hosts file without admin rights and cannot save the hosts file after editing. What you need to do is to get permission to edit the hosts file in Windows 11 and Windows 10.
This can be done by running Notepad as administrator first, then navigate to and open the hosts file from within Notepad. If Notepad has admin rights, you should be able to save the hosts file normally by pressing CTRL + S.
What IP address should I use in the hosts file?
If you have no idea what you are about to do, please do not add any mapping in the hosts file as it may brick some software that needs access to the host name. It will also block you from accessing the mapped host name or website address.
However, if you already have a set of mappings that you’ve decided to add beforehand, just follow the steps above to add them into the hosts file.
If you simply want to block a website or host name so that no program or software can access it, you can use the address 127.0.0.1 followed by the host name or website you want to block. This will resolve the host name or website address to the IP address 127.0.0.1, which is usually inaccessible.
Убрал UAC до ноля.
Варианты, которые перепробовал:
1. Открыть блокнот от имени администратора -> открыть HOSTS -> отредакттировать -> сохраняю с заменой и:
Отсутствуют разрешения на открытие этого файла . Обратитесь к владельцу файла или администратору сети.
2. Перемещаю HOSTS на рабочий стол, редактирую и обратно в папку не копируется с заменой:
пишет Вам неоходимо разрешение на выполнение этой операции
3. Нажать правой кнопкой мыши по файлы HOSTS -> свойства -> безопасность -> изменить
Тоже не срабатывает, так как нет возможности проставить галочки.
Что делать?
-
Вопрос задан
-
5464 просмотра
вообще без всяких заморочек — любой текстовый редактор с адмискими правами (только что перепроверил — запустил Far с админским уровнем — нет проблем)
другой вопрос — если у вас жесткая залочка файла hosts — ищите вирусы ;))
ps для примера, если у вас «игровая/пиратская сборка» — все. говорить не о чем. у вас вирусы
Пригласить эксперта
Включите назад UAC и не выключайте его — так безопаснее.
Скопируйте hosts куда нибудь на рабочий стол, отредактируйте, сохраните и сохранённый закиньте назад в его папку.
Спросит подтверждение перезаписи и подтверждение прав администратора.
…
PROFIT!
Открыть текстовый редактор от имени администратора вполне достаточно.
Значит надо получить права став владельцем файла — в безопасном режиме(если это еще работает).
загрузиться с LiveCD/DVD/flash USB и проверить на вирусы
Войдите, чтобы написать ответ
-
Показать ещё
Загружается…