Ubuntu – Permission Error copying files into Ubuntu on Windows with Windows copy/paste


I'm currently using Ubuntu on Windows from the Microsoft Store.

To try some of my Python scripts, I copied and pasted them to the documents folder I can access with Ubuntu session :


But when I lauch the scripts, it returns "PermissionError: [Errno 13] Permission denied: '[folderName]". Is there a way to copy/paste files and folders from Windows session to Ubuntu folders without having to run chmod on all files ?

Thanks for your time

Best Answer

You should not be manually copying data into the WSL installation from Windows - it will give you this permissions error when you do this. Rather, you should be copying from windows into WSL from within the WSL environment instead.

The Windows C drive is located at /mnt/c within WSL. If the scripts are located in C:\Users\username\My Documents\Python\ then you can do the following from within WSL to copy the scripts into the Ubuntu environment:

cp /mnt/c/Users/username/My\ Documents/Python/*.py ~

This will copy the data in and retain permissions so it works properly within the Windows subsystem for Linux. This also saves you from having to chmod typically.