I've set up WSL (Windows Subsystem for Linux) on my Windows 10 to utilize Bash. I've created a Linux user, installed the latest updates and upgrades, and I know how to access the Windows files through /mnt/c/Users etc. When I try to create a new file on my desktop, it denies permission:
rupert@DESKTOP-GT4APR9:/mnt/c/Users/zolta/OneDrive/Desktop$ touch
file.txt touch: cannot touch 'file.txt': Permission denied
How can I grant my Linux Bash user permission to create and modify files and directories on my Windows user desktop? Is that possible at all?
I would use sudo, i.e. sudo touch file.txt. Works for me in WSL2 Ubuntu (which is Debian based)
The path with which you are having problems,
rupert@DESKTOP-GT4APR9:/mnt/c/Users/zolta/OneDrive/Desktop
appears to live on OneDrive: While I am not a OneDrive expert, my understanding is that to access it from the command line, the remote data stored on OneDrive has to synced locally.
If you cd rupert@DESKTOP-GT4APR9:/mnt/c/Users/zolta, can you touch file.txt there?
What about accessing these folders from cmd or pwsh?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With