So I have the following folder organization in my Laravel project:
So my problem is, when a user uploads an image I move it to the folder user_image and then I use the Intervention Image to make it smaller, I use Image::make(#folder), then re size it and at last I save it. But to do that the folder user_image needs special permissions, with chmod 777 i can make it work, but I think it's a security breach if I leave the folder with 777 permissions.
Should I leave the folder with 777 permissions or shouldn't? Why?
Thanks.
Change all file permissions to 644. Change all folder permissions to 755. For storage and bootstrap cache (special folders used by laravel for creating and executing files, not available from outside) set permission to 777, for anything inside. For nodeJS executable, same as above.
Once installed you can do stuff like this: // Adding permissions to a user $user->givePermissionTo('edit articles'); // Adding permissions via a role $user->assignRole('writer'); $role->givePermissionTo('edit articles');
Change directory with cd command to the desired location under with you need to all directories to 755, and all files to 644 permissions. Then use first command to chmod 755 for all directories and sub directories. The second command will change all the files permission to 0644 (chmod 644) under the directory tree.
Easiest way to set permissions to 777 is to connect to Your server through FTP Application like FileZilla, right click on folder, module_installation, and click Change Permissions - then write 777 or check all permissions. Save this answer. Show activity on this post. Right click the folder, click on Properties.
I would suggest that you leave 777 chmod if it is only images but also place an empty php file called "index.php" inside that folder that will redirect all incoming connection to the root.
web user can't do any harm with 777 access in photos folder, so leave it.
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