You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ls: cannot read symbolic link 'Application Data': Permission denied
ls: cannot read symbolic link 'Cookies': Permission denied
ls: cannot read symbolic link 'Local Settings': Permission denied
ls: cannot read symbolic link 'My Documents': Permission denied
ls: cannot read symbolic link 'NetHood': Permission denied
ls: cannot read symbolic link 'PrintHood': Permission denied
ls: cannot read symbolic link 'Recent': Permission denied
ls: cannot read symbolic link 'SendTo': Permission denied
ls: cannot read symbolic link 'Start Menu': Permission denied
ls: cannot read symbolic link 'Templates': Permission denied
I am running a fresh install of Windows 10, and Ubuntu is the Linux distro I am using.
Reacted by xtrm0, David Montgomery, Cache Staheli, Phillip Choi, Yong Choi, Gabriel Marinho, Nikita Barskov, Stevie Howard, Andrew, Chawye Hsu and 18 more
Is this UserVoice worthy as it might considered a new feature. I know I would love to see this capability. Learning NTFS-3G can do it sounds to me like it's a simple reach out to that team to get the repro steps for implementing it and making any possible tailoring to make it more specific to Windows 10. I'm actually now curious to see about running NTFS-3G inside Ubuntu on WSL to test this scenario out. Maybe when I have more time for it.
Is this UserVoice worthy as it might considered a new feature.
Whether something is UserVoice worthy is in the eyes of the upvotes over there.
curious to see about running NTFS-3G inside Ubuntu on WSL
No that won't work per an oft-requested but currently unavailable feature, which I won't mention out loud because it doesn't have to do with the ask in the OP. But it starts with an F.
Well thanks for the enlightenment. Thanks for your hint about the unavailable feature. I had upvoted that already due to other things awhile ago. Hopefully it's addressed by fall this year but I won't be holding my breath either.
Why is this issue not resolved as "working as designed" / "not a bug"?
If a user gets permission denied on the Windows side, why is there an expectation that the same user ("Windows identity") does not get the same permission denied from LInux?
One of the key differences between a real-life Linux and WSL here is that a real-life Linux simply does not offer any security on reading NTFS, while WSL has a fully integrated identity system. If someone wants to break the identity / security system, using Linux in a virtual machine and then mapping the raw disk into that virtual machine would appear to be the right thing?
Provisionally because you do technically have Windows permissions to resolve the link. You get reasonable behavior in Cygwin for example. There is no particular reason why the link shouldn't resolve in WSL as well. No identity system is "broken" by doing so. And, since this Permission denied error is the first thing people see in cd /mnt/c/Users/<my username>, and that is where folks land by default in Windows Store WSL Ubuntu, the present situation is less than ideal. There are no cases (or common cases that I can think of) in Real Linux where a you'd get a cannot read symbolic link error out of ls. At worst, if you don't have permission to the followed path, then the pathname is helpfully displayed in red with ls -l --color. That WSL does not behave the same one could argue is a bug/diverge. I haven't looked at the source, but I suspect that error message comes from a defensive "huh, how'd that happen" error path in ls.
[The "provisionally" caveat is because one can call anything as-designed by fiat. This issue isn't tagged one way or another.]
Reacted by Max Pavlov, nepruett, Rishi Advani, Christian Esser, seantalbot-jisc and Mark Penner
It's a bug. If its attached to my files system (in my case, a cryptomator mounted folder on the Windows side) and they are in all ways mine, I should be able to list it.
I am using my windows home folder as my WSL home, I made this ls function for ~/.bashrc if anyone is interested:
ls() {
ls_opts="-h --color=auto"
if [ $# -eq 0 ]; then
if [ "$PWD" = "$HOME" ]; then
ls_opts="$ls_opts --hide='ntuser.*' --hide='NTUSER.*'"
fi
eval command ls "$ls_opts" '"$@"' 2>/dev/null
return 0
fi
eval command ls "$ls_opts" '"$@"'
}
this makes this behavior more pleasant to deal with.
Thanks for pinging this one. I was hoping this would resolve itself in WSL 2 with the new 9p /mnt/c. Alas no joy.
But now that we have Linux CIFS for reals, it did make me wonder how the Windows SMB server deals with those symlinks. Rather than present the files as "l---------" as suggested last summer, the entries just don't appear... because SMB never serves them up, and on the Linux side, getdents(2) never returns them. Which is along the lines of my earlier comment here.
So I guess a reasonable new ask is: "make 9p behave like SMB."
Practical work-around for now remains redirect 2>/dev/null. Someone motivated might also consider an upstream patch to Ubuntu's coreutils to make ls(1) more tolerant of the bug WSL's alternative filesystem semantics.
Something similar started happening to me, but it is only when ls --colors=auto
That's actually a half-interesting data point. It isn't colors. It happens any time the readlink(2) + stat(2) combo is evoked. Which doesn't happen in a bare ls(1), which only needs the name out of getdents(2). You'll get the same EPERM with:
$ "ls" -l # <--- EPERM fail, with or without the ls colors alias
The EPERM on those legacy (if that is the word) Windows symlinks such as /User/<username>/Cookies has been addressed in 18980. Works in both WSL1 and WSL2. Very awesome 💯.
Reacted by Chris Olin, Vuong, Bas van den Wollenberg, Yihong Zhang, Stanley Clark, Anton G. Fagerbakk and Rishi Advani
this makes this behavior more pleasant to deal with.
I know this is old but...
This is a nice workaround.
I had this problem with WSL when using Terminator via X Service.
But naming the function "ls" caused a syntax error so I worked around it by giving the function another name and defining an alias for it like this:
ls_override () {
ls_opts="-h --color=auto"
if [ $# -eq 0 ]; then
if [ "$PWD" = "$HOME" ]; then
ls_opts="$ls_opts --hide='ntuser.*' --hide='NTUSER.*'"
fi
eval command ls "$ls_opts" '"$@"' 2>/dev/null
return 0
fi
eval command ls "$ls_opts" '"$@"'
}
alias ls=ls_override
Activity
therealkenc commentedon Dec 23, 2017
Please post your reproduction steps.
danarth commentedon Jan 15, 2018
therealkenc I get the same issue as Ricardo Pimentel (@ricardojrgpimentel) . The only steps I take are:
cd /mnt/c/Users/<my username>lsThis gives me the following output:
I am running a fresh install of Windows 10, and Ubuntu is the Linux distro I am using.
therealkenc commentedon Jan 16, 2018
You don't have access to those on Windows either. Go to Windows Explorer, paste
C:\Users\you\Cookies.Interestingly enough though,
ntfs-3gappears to get this right under an analogous scenario on Real Linux. So yeah.WSLUser commentedon Jan 16, 2018
Is this UserVoice worthy as it might considered a new feature. I know I would love to see this capability. Learning NTFS-3G can do it sounds to me like it's a simple reach out to that team to get the repro steps for implementing it and making any possible tailoring to make it more specific to Windows 10. I'm actually now curious to see about running NTFS-3G inside Ubuntu on WSL to test this scenario out. Maybe when I have more time for it.
therealkenc commentedon Jan 16, 2018
Whether something is UserVoice worthy is in the eyes of the upvotes over there.
No that won't work per an oft-requested but currently unavailable feature, which I won't mention out loud because it doesn't have to do with the ask in the OP. But it starts with an F.
WSLUser commentedon Jan 16, 2018
Well thanks for the enlightenment. Thanks for your hint about the unavailable feature. I had upvoted that already due to other things awhile ago. Hopefully it's addressed by fall this year but I won't be holding my breath either.
[-]ls command doesnt have permission[/-][+]permission denied reading /mnt/c/Users/<user>/Cookies[/+]shoffmeister commentedon Jun 15, 2018
Why is this issue not resolved as "working as designed" / "not a bug"?
If a user gets permission denied on the Windows side, why is there an expectation that the same user ("Windows identity") does not get the same permission denied from LInux?
One of the key differences between a real-life Linux and WSL here is that a real-life Linux simply does not offer any security on reading NTFS, while WSL has a fully integrated identity system. If someone wants to break the identity / security system, using Linux in a virtual machine and then mapping the raw disk into that virtual machine would appear to be the right thing?
therealkenc commentedon Jun 15, 2018
Provisionally because you do technically have Windows permissions to resolve the link. You get reasonable behavior in Cygwin for example. There is no particular reason why the link shouldn't resolve in WSL as well. No identity system is "broken" by doing so. And, since this
Permission deniederror is the first thing people see incd /mnt/c/Users/<my username>, and that is where folks land by default in Windows Store WSL Ubuntu, the present situation is less than ideal. There are no cases (or common cases that I can think of) in Real Linux where a you'd get acannot read symbolic linkerror out ofls. At worst, if you don't have permission to the followed path, then the pathname is helpfully displayed in red withls -l --color. That WSL does not behave the same one could argue is a bug/diverge. I haven't looked at the source, but I suspect that error message comes from a defensive "huh, how'd that happen" error path inls.[The "provisionally" caveat is because one can call anything as-designed by fiat. This issue isn't tagged one way or another.]
shoffmeister commentedon Jun 15, 2018
Interesting.
cygwin bash:
Powershell:
I am my normal user self in both cases.
shoffmeister commentedon Jun 15, 2018
And, again, powershell, this time on Ubuntu:
8 remaining items
JustAShoeMaker commentedon Apr 11, 2019
It's a bug. If its attached to my files system (in my case, a cryptomator mounted folder on the Windows side) and they are in all ways mine, I should be able to list it.
rkitover commentedon May 7, 2019
I am using my windows home folder as my WSL home, I made this
lsfunction for~/.bashrcif anyone is interested:this makes this behavior more pleasant to deal with.
YantCaccia commentedon May 7, 2019
how to use that?
rkitover commentedon May 7, 2019
Just paste the function into your
~/.bashrcrkitover commentedon May 7, 2019
You might want this too:
Maissacrement commentedon Jun 16, 2019
On
~/.bashrcyou can just make an alias for output:Firstly create the file:
touch /var/log/.ls-errorIn a second time make you privilege on this file :
sudo chown $USER:$USER /var/log/.ls-errorIn
~/.bashrc:therealkenc commentedon Jun 16, 2019
Thanks for pinging this one. I was hoping this would resolve itself in WSL 2 with the new 9p
/mnt/c. Alas no joy.But now that we have Linux CIFS for reals, it did make me wonder how the Windows SMB server deals with those symlinks. Rather than present the files as "
l---------" as suggested last summer, the entries just don't appear... because SMB never serves them up, and on the Linux side,getdents(2)never returns them. Which is along the lines of my earlier comment here.So I guess a reasonable new ask is: "make 9p behave like SMB."
therealkenc commentedon Jun 22, 2019
Ever?
Just 'sayin.
Practical work-around for now remains redirect
2>/dev/null. Someone motivated might also consider an upstream patch to Ubuntu's coreutils to makels(1)more tolerant ofthe bugWSL's alternative filesystem semantics.therealkenc commentedon Aug 6, 2019
From #4104 (message)
That's actually a half-interesting data point. It isn't colors. It happens any time the
readlink(2)+stat(2)combo is evoked. Which doesn't happen in a barels(1), which only needs the name out ofgetdents(2). You'll get the same EPERM with:therealkenc commentedon Sep 20, 2019
The
EPERMon those legacy (if that is the word) Windows symlinks such as/User/<username>/Cookieshas been addressed in 18980. Works in both WSL1 and WSL2. Very awesome 💯.onuryurdupak commentedon Feb 20, 2020
I know this is old but...
This is a nice workaround.
I had this problem with WSL when using Terminator via X Service.
But naming the function "ls" caused a syntax error so I worked around it by giving the function another name and defining an alias for it like this: