Ivo
Ivo

Reputation: 363

The web server not permitted for chmod under WSL Ubuntu

I use Ubuntu 18 as WSL and everything was running well. Today I run the apache and started the application. When the app tried to perform chmod() on a file which was submited through form inside the folder project (I use Laravel), I received the following error:

chmod(): Operation not permitted

I have notice that this error happen when I try running chmod() from web server (www-data user). In the cli I dont have problems.

From other posts over the net, I understand that Windows has some changes regarding WSL permissions and drive mounts. But I didnt get answer or didnt succeed to resolve that issue.

Upvotes: 3

Views: 1915

Answers (2)

GregOs
GregOs

Reputation: 413

sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata,uid=1000,gid=1000,umask=22,fmask=111

did the trick for me.

Ref: https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/

Upvotes: 0

sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata

Reference: https://github.com/Microsoft/WSL/issues/3172#issuecomment-389157376

Upvotes: 2

Related Questions