我如何克服“符号链接不能被跟踪,因为它的类型是禁用的”。在获取符号链接的目标时出现错误?

时间:2021-04-03 16:26:46

Following on from a previous question, I am creating a symbolic link on a Server 2008 from a Vista machine using UNC paths. I can create the link just fine. I can go to the Server 2008 box and double click on the link in explorer to open the target file. What I cannot do though is use FileCreateW to get a handle to the UNC path link (from the Vista box). When I try it, it fails and GetLastError() returns error code 1463 (0x5B7), which is:

根据前面的问题,我正在使用UNC路径从Vista机器上创建一个服务器2008的符号链接。我可以创建链接。我可以转到Server 2008框,双击explorer中的链接,打开目标文件。我所不能做的是使用FileCreateW来获取UNC路径链接的句柄(从Vista box)。当我尝试它时,它失败了,GetLastError()返回错误代码1463 (0x5B7),它是:

The symbolic link cannot be followed because its type is disabled.

不能跟踪符号链接,因为它的类型是禁用的。

How to enable its "type" in Server 2008 (assuming the error means what it says)?

如何在Server 2008中启用它的“类型”(假设错误意味着它说了什么)?

8 个解决方案

#1


37  

To add to @David Arno's helpful answer, based on W7:

@David Arno的帮助回答,基于W7:


fsutil.exe can be made to show what arguments it takes by simply running:

fsutil。exe可以通过简单的运行来显示它所需要的参数:

fsutil behavior set /?

To report the current configuration, run fsutil behavior query SymlinkEvaluation - see @Jake1164's answer, particularly with respect to how a group policy may be controlling the behavior.

要报告当前的配置,运行fsutil行为查询SymlinkEvaluation——请参见@Jake1164的答案,特别是关于组策略如何控制行为的问题。

The symbolic-link resolution behavior is set on the machine that accesses a given link, not the machine that hosts it.

在访问给定链接的机器上设置了符号链接解析行为,而不是承载它的机器。

The behavior codes for fsutil behavior set SymlinkEvaluation - namely L2L, L2R, R2L, and R2R - mean the following:

fsutil行为规范的行为规范,即L2L、L2R、R2L、R2R,分别为:

  • L stands for "Local", and R for "Remote" (who would've thunk?)
  • L代表“Local”,R代表“Remote”(谁会有thunk?)
  • The FIRST L or R - before the 2 - refers to the location of the link itself (as opposed to its target) relative to the machine ACCESSING the link.
  • 第一个L或R(在2之前)指的是链接本身的位置(相对于它的目标),相对于访问链接的机器。
  • The SECOND L or R - after the 2 - refers to the location of the link's target relative to the machine where the LINK itself is located.
  • 第二个L或R -在2 -表示链接的目标相对于连接本身所在的机器的位置。

Thus, for instance, executing fsutil behavior set SymlinkEvaluation R2L means that you can access links:

因此,例如,执行fsutil行为设置SymlinkEvaluation R2L意味着您可以访问链接:

  • located on a remote machine (R)
  • 位于远程机器上(R)
  • that point to targets on that same remote machine (L)
  • 指向同一远程机器上的目标(L)

Unlike what David experienced on Vista, I, on W7, was able to resolve a remote link that pointed to a resource on another remote machine by enabling R2R alone (and not also having to enable R2L).

与David在Vista上所经历的不同,我在W7上可以通过启用R2R来解决指向另一台远程机器上的资源的远程链接(也不需要启用R2L)。

#2


55  

Well I found the answer, though to describe it as badly documented is an understatement!

我找到了答案,尽管把它描述成一个糟糕的记录是一种保守的说法!

First of all, this TechEd article highlights the fact that users can "enable or disable any of the four evaluations that are available in symbolic links". Those four "evaluations" include remote to local and local to remote. It doesn't give any clue as to how to do this.

首先,这篇TechEd文章强调了一个事实,即用户可以“启用或禁用符号链接中可用的四种评估”。这四项“评估”包括偏远地区和偏远地区。对于如何做到这一点,它没有给出任何线索。

However a further search revealed this fsutil help page, which does actually document how to "enable or disable any of the four evaluations that are available in symbolic links". So to fix the problem I was having, I need to issue the following command on the Vista box:

然而,进一步的搜索揭示了这个fsutil帮助页面,它实际上记录了如何“启用或禁用符号链接中可用的任何四个评估”。为了解决我所遇到的问题,我需要在Vista系统上发布以下命令:

fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1

in order to allow full access to where symlinks are pointing on both local and remote machines.

为了允许完全访问符号链接指向本地和远程机器的地方。

#3


9  

I recently found this on all my corporate Windows 7 boxes when one of my legacy programs stopped working. After some searching and finding these settings I tried setting via the command line and via the registry with no relief.

最近,当我的一个旧程序停止工作时,我在所有的公司Windows 7框中都发现了这一点。在搜索和找到这些设置之后,我尝试通过命令行设置,并通过注册表没有任何帮助。

I found that you can use the command from an elevated prompt:

我发现你可以从一个提升的提示中使用命令:

fsutil behavior query SymlinkEvaluation

This will return the status of these links AND in my case that they are being controlled by a group policy! Thanks IT department (you f@$#%$rs)!

这将返回这些链接的状态,在我的情况下,它们是由组策略控制的!感谢IT部门(您的$#%$rs)!

我如何克服“符号链接不能被跟踪,因为它的类型是禁用的”。在获取符号链接的目标时出现错误?

#4


6  

These settings can also be manipulated directly via the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem: See SymlinkLocalToLocalEvaluation, SymlinkLocalToRemoteEvaluation, SymlinkRemoteToLocalEvaluation, SymlinkRemoteToRemoteEvaluation.

这些设置也可以直接通过HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ \系统的注册表来操作:参见SymlinkLocalToLocalEvaluation, SymlinkLocalToRemoteEvaluation, SymlinkRemoteToLocalEvaluation, SymlinkRemoteToRemoteEvaluation。

if with "fsutil behavior query SymlinkEvaluation" you get message .."is currently controlled by group policy"..., check HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Filesystems\NTFS or simply search throug registry for "Symlink"

如果使用“fsutil行为查询SymlinkEvaluation”,您可以得到消息。“目前由集团政策控制”……,检查HKEY_LOCAL_MACHINE\软件\策略\ microsoft\ Windows\文件系统\NTFS,或简单地搜索“Symlink”

#5


5  

Thanks David for the tip, I was becoming desperate to fix this problem which made symlinks mostly useless.

感谢David给我的提示,我已经迫不及待地想要解决这一问题,这使得符号链接几乎毫无用处。

One should note that the default configuration for Vista is L2L and L2R enabled, but R2R and R2L disabled.

应该注意的是,Vista的默认配置是L2L和L2R,但是R2R和R2L是禁用的。

I first tried to enable only R2R, but this is not sufficient. R2L has to be enabled too.

我第一次尝试只启用R2R,但这还不够。R2L也必须启用。

The next question on my list: How to get rid of that stupid /D switch for the mklink command for directory links. The default link type should be inferred automatically from the target pathname type!

我的列表中的下一个问题是:如何摆脱对目录链接的mklink命令的愚蠢/D开关。默认的链接类型应该从目标路径名类型自动推断出来!

#6


2  

These settings can also be manipulated directly via the registry (requires local admin to write):

这些设置也可以通过注册表直接操作(要求本地管理员编写):

Registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

注册表键:HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ \控制文件系统

Registry values (name/data pairs):

注册表值(名称/数据对):

Name                             Type       Data  (1: Enabled; 0: Disabled)
-------------------------------------------------
SymlinkLocalToLocalEvaluation    REG_DWORD     1
SymlinkLocalToRemoteEvaluation   REG_DWORD     1
SymlinkRemoteToLocalEvaluation   REG_DWORD     1
SymlinkRemoteToRemoteEvaluation  REG_DWORD     1

Official documentation is difficult to find, but this appears to be an official Microsoft page: Selectively allow the evaluation of a symbolic link

官方文档很难找到,但这似乎是微软官方页面:有选择地允许对一个符号链接进行评估。

#7


2  

FYI if you have Group Policies in place controlling SymlinkEvaluation settings you CAN still set them yourself from the command line. They will be overwritten by GP at next reboot/login but your settings will work during your user session.

如果您有组策略来控制SymlinkEvaluation设置,您仍然可以从命令行设置它们。他们将在下一次重启/登录时被GP覆盖,但是您的设置将在您的用户会话期间工作。

So as a workaround if you need to set it to something other than what GP dictates you could even run a script at logon to set them after GP is applied.

所以作为一个解决方案,如果你需要把它设置成其他的东西,而不是GP所规定的,你甚至可以在登录后运行一个脚本,在GP应用之后设置它们。

#8


1  

Remote junction points work by default. For files you still need symlinks.

远程连接点在默认情况下工作。对于文件,您仍然需要符号链接。

#1


37  

To add to @David Arno's helpful answer, based on W7:

@David Arno的帮助回答,基于W7:


fsutil.exe can be made to show what arguments it takes by simply running:

fsutil。exe可以通过简单的运行来显示它所需要的参数:

fsutil behavior set /?

To report the current configuration, run fsutil behavior query SymlinkEvaluation - see @Jake1164's answer, particularly with respect to how a group policy may be controlling the behavior.

要报告当前的配置,运行fsutil行为查询SymlinkEvaluation——请参见@Jake1164的答案,特别是关于组策略如何控制行为的问题。

The symbolic-link resolution behavior is set on the machine that accesses a given link, not the machine that hosts it.

在访问给定链接的机器上设置了符号链接解析行为,而不是承载它的机器。

The behavior codes for fsutil behavior set SymlinkEvaluation - namely L2L, L2R, R2L, and R2R - mean the following:

fsutil行为规范的行为规范,即L2L、L2R、R2L、R2R,分别为:

  • L stands for "Local", and R for "Remote" (who would've thunk?)
  • L代表“Local”,R代表“Remote”(谁会有thunk?)
  • The FIRST L or R - before the 2 - refers to the location of the link itself (as opposed to its target) relative to the machine ACCESSING the link.
  • 第一个L或R(在2之前)指的是链接本身的位置(相对于它的目标),相对于访问链接的机器。
  • The SECOND L or R - after the 2 - refers to the location of the link's target relative to the machine where the LINK itself is located.
  • 第二个L或R -在2 -表示链接的目标相对于连接本身所在的机器的位置。

Thus, for instance, executing fsutil behavior set SymlinkEvaluation R2L means that you can access links:

因此,例如,执行fsutil行为设置SymlinkEvaluation R2L意味着您可以访问链接:

  • located on a remote machine (R)
  • 位于远程机器上(R)
  • that point to targets on that same remote machine (L)
  • 指向同一远程机器上的目标(L)

Unlike what David experienced on Vista, I, on W7, was able to resolve a remote link that pointed to a resource on another remote machine by enabling R2R alone (and not also having to enable R2L).

与David在Vista上所经历的不同,我在W7上可以通过启用R2R来解决指向另一台远程机器上的资源的远程链接(也不需要启用R2L)。

#2


55  

Well I found the answer, though to describe it as badly documented is an understatement!

我找到了答案,尽管把它描述成一个糟糕的记录是一种保守的说法!

First of all, this TechEd article highlights the fact that users can "enable or disable any of the four evaluations that are available in symbolic links". Those four "evaluations" include remote to local and local to remote. It doesn't give any clue as to how to do this.

首先,这篇TechEd文章强调了一个事实,即用户可以“启用或禁用符号链接中可用的四种评估”。这四项“评估”包括偏远地区和偏远地区。对于如何做到这一点,它没有给出任何线索。

However a further search revealed this fsutil help page, which does actually document how to "enable or disable any of the four evaluations that are available in symbolic links". So to fix the problem I was having, I need to issue the following command on the Vista box:

然而,进一步的搜索揭示了这个fsutil帮助页面,它实际上记录了如何“启用或禁用符号链接中可用的任何四个评估”。为了解决我所遇到的问题,我需要在Vista系统上发布以下命令:

fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1

in order to allow full access to where symlinks are pointing on both local and remote machines.

为了允许完全访问符号链接指向本地和远程机器的地方。

#3


9  

I recently found this on all my corporate Windows 7 boxes when one of my legacy programs stopped working. After some searching and finding these settings I tried setting via the command line and via the registry with no relief.

最近,当我的一个旧程序停止工作时,我在所有的公司Windows 7框中都发现了这一点。在搜索和找到这些设置之后,我尝试通过命令行设置,并通过注册表没有任何帮助。

I found that you can use the command from an elevated prompt:

我发现你可以从一个提升的提示中使用命令:

fsutil behavior query SymlinkEvaluation

This will return the status of these links AND in my case that they are being controlled by a group policy! Thanks IT department (you f@$#%$rs)!

这将返回这些链接的状态,在我的情况下,它们是由组策略控制的!感谢IT部门(您的$#%$rs)!

我如何克服“符号链接不能被跟踪,因为它的类型是禁用的”。在获取符号链接的目标时出现错误?

#4


6  

These settings can also be manipulated directly via the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem: See SymlinkLocalToLocalEvaluation, SymlinkLocalToRemoteEvaluation, SymlinkRemoteToLocalEvaluation, SymlinkRemoteToRemoteEvaluation.

这些设置也可以直接通过HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ \系统的注册表来操作:参见SymlinkLocalToLocalEvaluation, SymlinkLocalToRemoteEvaluation, SymlinkRemoteToLocalEvaluation, SymlinkRemoteToRemoteEvaluation。

if with "fsutil behavior query SymlinkEvaluation" you get message .."is currently controlled by group policy"..., check HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Filesystems\NTFS or simply search throug registry for "Symlink"

如果使用“fsutil行为查询SymlinkEvaluation”,您可以得到消息。“目前由集团政策控制”……,检查HKEY_LOCAL_MACHINE\软件\策略\ microsoft\ Windows\文件系统\NTFS,或简单地搜索“Symlink”

#5


5  

Thanks David for the tip, I was becoming desperate to fix this problem which made symlinks mostly useless.

感谢David给我的提示,我已经迫不及待地想要解决这一问题,这使得符号链接几乎毫无用处。

One should note that the default configuration for Vista is L2L and L2R enabled, but R2R and R2L disabled.

应该注意的是,Vista的默认配置是L2L和L2R,但是R2R和R2L是禁用的。

I first tried to enable only R2R, but this is not sufficient. R2L has to be enabled too.

我第一次尝试只启用R2R,但这还不够。R2L也必须启用。

The next question on my list: How to get rid of that stupid /D switch for the mklink command for directory links. The default link type should be inferred automatically from the target pathname type!

我的列表中的下一个问题是:如何摆脱对目录链接的mklink命令的愚蠢/D开关。默认的链接类型应该从目标路径名类型自动推断出来!

#6


2  

These settings can also be manipulated directly via the registry (requires local admin to write):

这些设置也可以通过注册表直接操作(要求本地管理员编写):

Registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

注册表键:HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ \控制文件系统

Registry values (name/data pairs):

注册表值(名称/数据对):

Name                             Type       Data  (1: Enabled; 0: Disabled)
-------------------------------------------------
SymlinkLocalToLocalEvaluation    REG_DWORD     1
SymlinkLocalToRemoteEvaluation   REG_DWORD     1
SymlinkRemoteToLocalEvaluation   REG_DWORD     1
SymlinkRemoteToRemoteEvaluation  REG_DWORD     1

Official documentation is difficult to find, but this appears to be an official Microsoft page: Selectively allow the evaluation of a symbolic link

官方文档很难找到,但这似乎是微软官方页面:有选择地允许对一个符号链接进行评估。

#7


2  

FYI if you have Group Policies in place controlling SymlinkEvaluation settings you CAN still set them yourself from the command line. They will be overwritten by GP at next reboot/login but your settings will work during your user session.

如果您有组策略来控制SymlinkEvaluation设置,您仍然可以从命令行设置它们。他们将在下一次重启/登录时被GP覆盖,但是您的设置将在您的用户会话期间工作。

So as a workaround if you need to set it to something other than what GP dictates you could even run a script at logon to set them after GP is applied.

所以作为一个解决方案,如果你需要把它设置成其他的东西,而不是GP所规定的,你甚至可以在登录后运行一个脚本,在GP应用之后设置它们。

#8


1  

Remote junction points work by default. For files you still need symlinks.

远程连接点在默认情况下工作。对于文件,您仍然需要符号链接。