Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permissions "public" folder Laravel

So I have the following folder organization in my Laravel project:

  • public
    • user_images
    • group_images
    • img
    • css
    • vendor
    • etc ...

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.

like image 291
Hugo Avatar asked Dec 25 '15 11:12

Hugo


People also ask

How do I give permission to a folder in laravel?

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.

How do I give permission in laravel?

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');

How do I give permission to 644?

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.

How do I set 777 permissions to a folder in Windows 10?

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.


2 Answers

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.

like image 84
Vojko Avatar answered Sep 20 '22 01:09

Vojko


web user can't do any harm with 777 access in photos folder, so leave it.

like image 31
Buglinjo Avatar answered Sep 19 '22 01:09

Buglinjo