[Samba] How to suppress/handle junction points in CIFS-mounting Windows 7 shares on Linux?

Daniel Barclay danielbarclay.oss at gmail.com
Sat Jul 2 21:08:39 UTC 2022


When mounting a Windows 7 share on Linux, how *can Windows junction points be suppressed* (or otherwise handled so that one that points up to a containing directory can't cause an endless loop)?

For example, the (standard, Windows-created) junction point at "C:\Users\someuser\Application Data\" links back up to "C:\Users\someuser\".

When I try to mount C: on Linux and run a command that recursively traverses down subdirectories (e.g., find, du) the command iterates through (the Linux pathnames for):

  * C:\Users\someuser\Application Data\
  * C:\Users\someuser\Application Data\Application Data\
  * C:\Users\someuser\Application Data\Application Data\Application Data\
  * etc.

until hitting some limit and then hanging.

Apparently, Linux and/or the commands see the junction point as a regular directory, not recognizing it as a symbolic link or other structure that can cause a filesystem traversal loop.

(In Windows Explorer, the junction point shows up as a folder that can't be opened ("Access is denied"). In CygWin on Windows, the junction point seems to show up as a regular Unix symlink, so the find command normally skips it, and even with -follow specified, find can recognize and cut the traversal loop.)

So, *how can junction point be suppressed or handled?*  Is there any way to:
- Tell *Windows to suppress* reporting *junction points* as directories?
- Get *Linux*'s CIFS mounting to recognize junction points and *present them as symbolic links?*
- Get *Linux*'s CIFS mounting to recognize junction points and simply *suppr**ess them?*

(I've tried with both the administrative share for C: (C$) and a user-created share of C:.)

Thanks,
Daniel



More information about the samba mailing list