colorls: Windows 10 with WSL - Permission denied @ rb_file_s_lstat
Description
Colorls does not display information on any files and/or directories if in between them there are some inaccessible files. In the below example I’m trying to list files of my C drive using WSL on windows 10:
root@machine /mnt/c
λ colorls
/mnt/c: Permission denied @ rb_file_s_lstat - /mnt/c/hiberfil.sys
In contrast the regular ls -l outputs the following information:
root@machine /mnt/c
λ ls -l
ls: cannot access 'hiberfil.sys': Permission denied
ls: cannot access 'pagefile.sys': Permission denied
ls: cannot access 'swapfile.sys': Permission denied
total 884K
...
dr-xr-xr-x 0 root root 512 Jun 20 11:48 'Program Files'
dr-xr-xr-x 0 root root 512 May 27 08:51 Users
dr-xr-xr-x 0 root root 512 Jun 25 14:11 Windows
-????????? ? ? ? ? ? hiberfil.sys
-r-xr-xr-x 1 root root 884K Dec 1 2006 msdia80.dll
-????????? ? ? ? ? ? pagefile.sys
-????????? ? ? ? ? ? swapfile.sys
...
BR /Slawek
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 18
same here too…
This is because of the difference in permission handling with Windows filesystems and Unix-based filesystems. Unix traditionally stores file attributes as part of the directory. When you have permission reading the directory, you can list all the files and their attributes like file size and time stamp. With windows filesystems, this information is attached to the files themselves and you cannot even read the file size if you have no permission.
This issue appears only when you tend to look at system protected stuff… And I have no idea how disaster-like it would be to delete user from C…🥵