17
8
Differences
┌───────────────┬──────────┬──────────┬──────┬───────────┬─────┐ │ │ Absolute │ Relative │ File │ Directory │ UNC │ ├───────────────┼──────────┼──────────┼──────┼───────────┼─────┤ │ Symbolic link │ Yes │ Yes │ Yes │ Yes │ Yes │ │ Junction │ Yes │ - │ - │ Yes │ - │ └───────────────┴──────────┴──────────┴──────┴───────────┴─────┘
Scenario
Let's assume we're creating a reparse point to create the redirect C:\SomeDir => D:\SomeDir
Since this scenario only requires local, absolute paths, either a junction or symlink would work. In this situation, is there any advantage to using one or the other?
Assume Windows 7 for the OS, disregarding backward-compatibility. (Prior to Vista, symlinks are not supported natively, though there is a 3rd-party driver that provides symlink support on Windows XP.)
Update
I have found another difference.
- Symbolic Link - Link's permissions only affect delete/rename operations on the link itself, read/write access (to the target) is governed by the target's permissions
- Junction - Junction's permissions affect enumeration, revoking permissions on the junction will deny file listing through that junction, even if the target folder has more permissive ACLs
The permissions make it interesting, as symlinks can allow legacy applications to access configuration files in UAC-restricted areas (such as %ProgramFiles%
) without changing existing access permissions, by storing the files in a non-restricted location and creating symlinks in the restricted directory.
Update 2
Windows 8.1 will resolve symbolic directory links when navigating into one via the textbox in a Save As...
dialog box. Junctions are not expanded.
I won't make this a full answer unless requested, but if you are using a GNU or other non-Windows system to access the volume via
mount.cifs
, then symlinks will appear as such whereas junctions will be seen as normal directories — probably because of the point where the IO resolution occurs, i.e. locally on the Windows host. – can-ned_food – 2017-10-14T08:45:07.660Do you have a link to the permissions difference info? That is quite the find. – surfasb – 2011-12-09T18:58:29.647
My testing confirms that read access to the target directory (i.e., listing directory contents) is restricted by the permissions on the junction point in addition to those on the target directory. However, no other access appears to be affected. In particular you can create files and subfolders if the target directory permissions allow it, regardless of the junction point permissions. – Harry Johnston – 2011-12-11T19:45:11.700
@HarryJohnston: Initially, I suspected some inconsistency as I block delete and write permissions to juctions but items and subfolders underneath do just fine. – surfasb – 2011-12-12T16:27:12.497