WSL cannot handle symbolic links to CIFS/SMB file shares
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
**Is your feature request related to a problem? Please describe.**
In my home network environment rather than grapple with the complexities of roaming profiles and redirecting user home dirs, i just have a simple setup where-
- Every user has a home directory on a Linux server that is published via Samba
- On client PCs each user has in their home folder a symbolic link called `Documents on Server` that links to `\\server\user\Documents`
Windows will navigate to or load/save files via the link transparently without any manual mounting procedure.
However WSL fails to even read the the link vin an `ls` command, let alone access files or folders through it. Listing a directory containing one of these links produces the result-
```
/mnt/c/users/username$ ls
ls: cannot read symbolic link 'Documents on Server': Input/output error
```
**Describe the solution you'd like**
Some Linux systems will auto-mount remote filesystems, including CIFS/SMB shares accessed via a symlink, if the link is opened via a file browser such as Nautilus or Thunar. However this doesn't work if the link is being traversed via CLI commands.
The best solution for non-WSL Linux environments that I have found so far (that doesn't just try to bulk mount every users remote folders at boot time via fstab) is using `pam_mount` to mount each user's remote folders when they log in, but this is quite tricky to set up.
WSL exists in a mixed OS environment by definition so it should be good at this "out of the box".
Ideally WSL would-
1) Understand symbolic links in general (it seems to struggle with this at the moment)
2) Automatically mount remote filesystems when they are accessed (respecting permissions etc.) via any mechanism, CLI or CUI, and via an explicit path or navigating via one or more symlinks
3) A fully general solution would need to be configured with fs types and mount options for known remote filesystems. This could be done via entries in fstab with the `noauto ` option. It would be nice to have a new `ondemand` mount option for this, but that's extra sauce.
4) However at a basic "zero config" level it might be helpful to assume an fstype of CIFS for remote directories accessed via a UNC style `\\servername\folder` path if there is no mount information available in fstab, given the prevalance of CIFS in both Windows-to-Windows file sharing and Samba for Linux.
**Describe alternatives you've considered**
Manually setting up the pam_mount solution for my WSL client environment(s). However I'm assuming this would need to be done separately for every Linux guest OS, and every user that uses WSL, which is ok for a single user but would scale badly for goups of users.
**Additional context**
Contributor guide
Research direction
No repository files, tests, or entry points are named. Start by reproducing the `ls` failure for a Windows symbolic link targeting a `\\server\user\Documents` path, then investigate the WSL filesystem and mount-handling areas; done would require supported traversal and access to CIFS/SMB shares through such links, including permission behavior and CLI use.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- networking, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 18/100