6

Windows 7 中 C:\Windows\Temp 文件夹的默认 NTFS 安全设置是什么?

4

3 回答 3

7

SetACL能够列出 C:\Windows\Temp 的权限,而无需先更改它们。我在新安装的系统上使用命令检索了默认权限,setacl -on c:\Windows\Temp -ot file -actn list并在我的系统上进行了验证:

DACL(protected+auto_inherited):
Users           FILE_ADD_FILE+FILE_ADD_SUBDIRECTORY+FILE_TRAVERSE   allow   container_inherit
Administrators  full   allow   no_inheritance
Administrators  full   allow   container_inherit+object_inherit+inherit_only
SYSTEM          full   allow   no_inheritance
SYSTEM          full   allow   container_inherit+object_inherit+inherit_only
CREATOR-OWNER   full   allow   container_inherit+object_inherit+inherit_only

如果您更喜欢 GUI 应用程序,SetACL Studio可以列出系统每个部分的权限,而无需像 Explorer 一样先更改它们。这是 C:\Windows\Temp 在 SetACL Studio 中的样子:

SetACL Studio - C:\Windows\Temp 上的权限

于 2012-08-11T21:29:04.313 回答
0

以下URL显示了 Windows 2000 中的默认 NTFS 权限。看起来 google 尚未找到 Windows 7 的更新。不过,对于许多标准目录(如 %Systemroot%\Temp)来说,查看 NTFS 安全设置是一个很好的起点。

于 2012-08-11T07:10:41.220 回答
-2

真的有关系吗?无论如何,您不应该在代码中硬编码路径。如果那不是我保存临时文件夹的位置,或者那不是我的 Windows 目录的名称,或者我没有在驱动器 C 上安装 Windows,该怎么办?您的应用程序仍然有效吗?哦哦。

相反,调用GetTempPath函数,它将返回为在当前环境中存储临时文件而设计的目录的路径。您可以假设您将在返回的目录中拥有所有必要的读/写权限。

如果从您之前的一些问题中可以判断,您正在为 .NET Framework 编写代码,那么这一切都很好地包含在System.IO.Path.GetTempPathfunction中。

于 2012-08-11T07:11:39.053 回答