Search code examples
windowswinapifilesystemsntfssymlink

WriteFile for a symbolic link which points a network volume's file


I made a symbolic link file.

mklink C:\LinkFileToPointNetworkFile.txt Z:\NetworkFile.txt

Then I opened and read the file. Good. It works well. The target file's data has been read.
-Of course, I didn't use FILE_FLAG_OPEN_REPARSE_POINT

But if I try writing to the file, I get a 'access is denied'.
This is not what I expected.
Why does it work like this?


Solution

  • Symlinks are intentionally disabled over network shares by default for security reasons. You can change this on your machine via:

    fsutil behavior set SymlinkEvaluation L2L:1 L2R:1