windows Windows权限问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4555736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:52:15  来源:igfitidea点击:

Windows permission problem

windows

提问by CHID

Hi I need to save a file in c:/windows/system32/driversfolder. But when I try to save it is not allowing me. I tried to change permissions by right clicking that folder and modifying in the security tab. Yet it is not allowing me to change. what should be done in order to gain access privilege??

嗨,我需要在c:/windows/system32/drivers文件夹中保存一个文件。但是当我试图保存它时它不允许我。我试图通过右键单击该文件夹并在安全选项卡中进行修改来更改权限。然而它不允许我改变。应该怎么做才能获得访问权限?

回答by In silico

Have you tried editing the hosts file using Notepad launched via the "Run as administrator" command?

您是否尝试过使用通过“以管理员身份运行”命令启动记事本编辑主机文件?

According to the knowledge base article, if you get an error message that looks like this:

根据知识库文章,如果您收到如下所示的错误消息:

Access to C:\Windows\System32\drivers\etc\ hosts was denied

访问 C:\Windows\System32\drivers\etc\ 主机被拒绝

Or like this:

或者像这样:

Cannot create the C:\Windows\System32\drivers\etc\hosts file. Make sure that the path and file name are correct.

无法创建 C:\Windows\System32\drivers\etc\hosts 文件。确保路径和文件名正确。

Try this:

尝试这个:

Start → All Programs → Accessories → right-click "Notepad" → Run as administrator → Modify hosts file appropriately → Save

开始→所有程序→附件→右键“记事本”→以管理员身份运行→适当修改hosts文件→保存

Note:

笔记:

添加/修改系统目录中的文件是一个 very, very, very bad idea非常非常非常糟糕的主意。对于主机文件的这种特定情况是可以接受的,但一般来说adding and modifying files in the system folders is verboten在系统文件夹中添加和修改文件是禁止的

回答by David

Short answer: Are you an admin on the system? If not, then you can't edit permissions of system folders. (And, depending on the version of Windows, it may be difficult/obtuse even for an Admin to do it.)

简短回答:您是系统管理员吗?如果没有,则您无法编辑系统文件夹的权限。(而且,根据 Windows 的版本,即使是管理员也可能很难/迟钝。)

Long answer: You shouldn't be doing this. That path (and many like it) is used by the OS for its own design and its own purposes. You probably don't want to mess with it. You may unintentionally break something. It's also a very unintuitive place to store things that aren't part of the OS installation. What are you trying to store there and why? If it's part of an application, it should be stored with that application. If it's something for a user, it should be stored in the user's space. Etc.

长答案:你不应该这样做。该路径(以及许多类似路径)被操作系统用于其自身的设计和目的。你可能不想惹它。您可能会无意中破坏某些东西。它也是一个非常不直观的地方来存储不属于操作系统安装的东西。你想在那里存储什么,为什么?如果它是应用程序的一部分,则应与该应用程序一起存储。如果它是给用户的东西,它应该存储在用户的空间中。等等。

Edit:Based on your comment in response to your question: The hostsfile is actually one level down from there, in the etcfolder that's under drivers. You shouldn't have to change any folder-level permissions to edit that. If you can't edit the file, try to change its permissions. If you can't do that, it doesn't sound like you have admin rights, which you'll probably need.

编辑:根据在针对您的问题您的评论:该hosts文件实际上是有一个级别了下来,在etc文件夹中的下drivers。您不必更改任何文件夹级别的权限即可对其进行编辑。如果您无法编辑该文件,请尝试更改其权限。如果您不能这样做,则听起来您没有管理员权限,而您可能需要这些权限。

回答by Neil

Try saving it to another place (Documents perhaps?) and then copy it there. It will ask you if you're sure you want to do it, but at this point say yes and it'll copy the file there. Windows won't let you simply create a file in c:/windows/system32/drivers for obvious reasons.

尝试将其保存到另一个地方(也许是文档?),然后将其复制到那里。它会询问您是否确定要这样做,但此时说是,它会将文件复制到那里。出于显而易见的原因,Windows 不会让您简单地在 c:/windows/system32/drivers 中创建文件。

And I don't need to tell you to be careful, do I? Hmm??

而且我不需要告诉你要小心,是吗?唔??

回答by sean

I was having this issue and opening notepad by right clicking it and selecting "run as administrator" I then opened and edited the hosts file and it allowed me to save where it did not before.

我遇到了这个问题并通过右键单击它并选择“以管理员身份运行”打开记事本,然后我打开并编辑了主机文件,它允许我保存以前没有的地方。