Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Wygekas's avatar

No permissions to folders created by www-data

When new user is registered in Laravel website, my website creates new folder for that user and inserts default avatar. BUT when new user is registered, that folder has no permissions (d-w-r-sr-T and belongs to user: www-data group: www-data). How can i define what kind of permissions folder should have when created new by system?

0 likes
3 replies
Tray2's avatar

Why do you create a OS user when creating an application user?

One option is to add the created user to the www-data group however this gives the user pretty much full access to everything in your web root which is really bad.

I say rethink your strategy here and give some really compelling reasons to do it that way.

Wygekas's avatar
Wygekas
OP
Best Answer
Level 1

SOLVED: Turns out i forgot that my observer which fired when new user was created, had mkdir where i specified 700 permissions, i changed for testing to 0777, now works.

  • I updated my question to specify that user is for Laravel website user/customer
Tray2's avatar

Never use 777 as a permission. With that permission anyone can crash your site by running a simple rm -rf ./

Please or to participate in this conversation.