Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

没有写入 Hosts 文件的权限 #645

Open
XuMengEnEli opened this issue Oct 8, 2021 · 8 comments
Open

没有写入 Hosts 文件的权限 #645

XuMengEnEli opened this issue Oct 8, 2021 · 8 comments

Comments

@XuMengEnEli
Copy link

System (Mac, Windows 7/8/10, Linux) / 操作系统

windows11

SwitchHosts! Version / SwitchHosts! 版本

image

Description / 描述

image

How to reproduce / 重现步骤

image

@acustictags
Copy link

win10下可以尝试修改一下hosts文件的权限。不知道win11下权限菜单有没有更改。

01

  1. 打开C:\Windows\System32\drivers\etc目录
  2. 右键hosts文件,选择属性
  3. 在弹出的窗口中,切换到安全标签页
  4. 点击🛡编辑按钮
  5. 在弹出的窗口中,找到组或用户名一栏,选中ALL APPLICATION PACKAGES
  6. 在下方ALL APPLICATION PACKAGES的权限一栏中,找到写入一行,勾选允许
  7. 点击应用,再打开SwitchHosts测试能否修改文件

@llyjj5464
Copy link

俺也一样 win11

@llyjj5464
Copy link

我解决了, 铁铁看下hosts文件的权限。只读勾掉。
image

@chenyuncai
Copy link

我是每次打开,都右键“已管理员身份运行”,

@jeff1992
Copy link

jeff1992 commented Oct 12, 2021

解决办法汇总:

  1. 检查文件的“只读”属性,去掉“勾选”
  2. 检查文件的“隐藏”属性,去掉“勾选”,如果无法去除,可以执行命令行 "attrib -s -h C:\Windows\System32\drivers\etc\hosts"去除
  3. 以“管理员身份”运行switchhosts
  4. 为"hosts"文件增加当前用户的“完全控制”权限

@qtxzy
Copy link

qtxzy commented Dec 3, 2021

无论我怎么努力,上面的所有方法都尝试了,还是所有的hosts都是只读状态,包括系统hosts和自己加的远程hosts(但是刷新可以成功),已经麻了,我也不知道是什么问题,之前是可以使用的,忽然就不能了,不知道是不是便携版的原因。。。
system version 20H2 19042
software version 4.0.3

@ren-yc
Copy link

ren-yc commented Jan 28, 2022

同问,上面和百度的各种方法都用了还是显示 hosts 只读,后台报错

[Error: EPERM: operation not permitted, open 'C:\WINDOWS\system32\drivers\etc\hosts'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'open',
  path: 'C:\\WINDOWS\\system32\\drivers\\etc\\hosts'
}

@aomo5
Copy link

aomo5 commented Jun 19, 2023

在 Windows 11 中,hosts文件通常位于以下路径:C:\Windows\System32\drivers\etc\hosts。

如果你尝试更改hosts文件的只读属性,但每次更改后它都自动变回只读属性,可能是由于操作系统的保护机制导致的。Windows 11具有一种叫做"保护模式"的特性,该特性会在某些系统文件上自动应用只读属性,以防止非授权的更改。
还没找到解决方法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants